How to get Form Group name and Form Type (EditForm, DispForm)

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
Patrick1010
Posts: 11
Joined: Wed Jun 07, 2017

29 Aug 2017

Hello,

I'm wondering is there a way (or token) which could give me the name of the FormGroup and the type (EditForm, DispForm) of the form?

I'm particularly looking for a way to differentiate between EditForm and DisplayForm within the JS code panel.
Right now I'm able to differentiate between EditForm and NewForm by simply checking the title column. If the title column is empty then I know it's the NewForm.

kind regards,
Patrick

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

29 Aug 2017

Hello, Patrick!
On our forms you can simply use this code to get the type of the form:

Code: Select all

fd._formType();
Cheers

Patrick1010
Posts: 11
Joined: Wed Jun 07, 2017

29 Aug 2017

Hello Nikita,

Thanks a lot, this works excellent!

regards,
Patrick

User avatar
smithme
Posts: 45
Joined: Wed Jul 26, 2017

30 Aug 2017

Nikita Kurguzov wrote:
29 Aug 2017
Hello, Patrick!
On our forms you can simply use this code to get the type of the form:

Code: Select all

fd._formType();

Where is the full documentation of the fd object? As I look around the forums I keep seeing different properties and methods of fd but I can't find any documentation that explains it all.
City of Nampa
Idaho
United States of America

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

31 Aug 2017

smithme wrote:
30 Aug 2017
Where is the full documentation of the fd object? As I look around the forums I keep seeing different properties and methods of fd but I can't find any documentation that explains it all.
Most of the methods are documented on our site in JS Framework section - https://spform.com/documentation/js/manager
But there are some methods that were excluded from documentation, mostly because they were intended primarily for internal use, they are often utilized by other methods.

This is one of the examples, it wasn't fully intended for external use. These methods are safe to use as we are not planning on changing them.

Perhaps one day documentation will be updated to include more methods that could be useful to our users.
Cheers

Patrick1010
Posts: 11
Joined: Wed Jun 07, 2017

08 Sep 2017

Hello Nikita,

getting the form type in this way is quite useful.
I'm wondering is there a way which could provide me with the name of the FormGroup used?


kind regards,
Patrick

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

08 Sep 2017

Hello, Patrick!
Unfotunately, there is no code to get the name of a Group. Can you describe your case to us? Perhaps we can find a way for you to get the result you need.
Cheers

Patrick1010
Posts: 11
Joined: Wed Jun 07, 2017

08 Sep 2017

Hello Nikita,

I'm always using the 'Edit Form' of 'All Users' as master for my differen form groups. I don't customize the other form groups because of maintenance reasons. Because as soon there would be a change I need to apply it everywhere. With this approach I need to apply it once and can import the 'All Users' form back into the different form groups. After that I only need to change the variable fdGroupCurr.

Therefore my code always looks similar like below where the variable fdGroupCurr defines the behaviour of the current form Group.
This is the reason why I think it would be useful to know the name of the form as I wouldn't need to use the variable fdGroupCurr anymore.


// -----------------------------------------------------------------------------------------------------------------------------
// Defined Group names: "ALL" (All Users = Erfasser), PC (Print Center), "ADMIN"
// -----------------------------------------------------------------------------------------------------------------------------
var fdGroup = {ALL:1, PC:2, ADMIN:3};
var fdGroupCurr = fdGroup.PC;

// -----------------------------------------------------------------------------------------------------------------------------
// condition depending on the form group
// -----------------------------------------------------------------------------------------------------------------------------
if (fdGroupCurr == fdGroup.PC || fdGroupCurr == fdGroup.ADMIN) {
// Form settings for: 'PC' users
$('#fd_tabcontrol-0').tabs('option', 'disabled', []); // disable these tabs

// show Save buttons
$(".btnSave").parent().parent().show();
$(".btnBearbeiten").parent().parent().show();
$(".btnAbschliessen").parent().parent().show();
$("a[id$='Ribbon.ListForm.Edit.Commit.Publish-Large']").show();

} else {
// Form settings for all others
$('#fd_tabcontrol-0').tabs('option', 'disabled', [2]); // disable these tabs

// show Save button
$(".btnSave").parent().parent().show();

// hide Save buttons
$(".btnBearbeiten").parent().parent().hide();
$(".btnAbschliessen").parent().parent().hide();
}


kind regards,
Patrick

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

11 Sep 2017

Sadly, there is no convenient way. My best advise would be to store variable groupName next to variable fdGroupCurr, that way you'll only need to change 2 variables.
Cheers

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests