Focus on different tabs for different views

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
Lucila Mortara
Posts: 3
Joined: Thu Sep 03, 2015

03 Sep 2015

Hello,

Is it possible to make the Edit Form to be open on the second tab instead of the first one as it's set by default.? And if possible, is it possible to make it more complex, including an evaluation of a field.

For example, if the project status field value is on going then if opening the edit view it should go to the Status Tab.

Thanks,

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

04 Sep 2015

Hello!

Are you talking about the Tabs control? If so, you can insert the following code into the JavaScript editor for the Edit form:

Code: Select all

$('#fd_tabcontrol-0').tabs('option', 'active', 1);
Where fd_tabcontrol-0 is the ID of your tab control (it's auto incremented starting from 0: fd_tabcontrol-0, fd_tabcontrol-1, etc) Or to do it for all tab controls on the page:

Code: Select all

$('div[id^="fd_tabcontrol-"].ui-tabs').tabs('option', 'active', 1);


If you want to implement some logic with opening a particular tab, you can do something along the lines of:

Code: Select all

if (fd.field('StatusFieldInternalName').value() ==  'Ongoing') {
 $('#fd_tabcontrol-0').tabs('option', 'active', 2);
}
else {
 $('#fd_tabcontrol-0').tabs('option', 'active', 1);
}
Where the last digit in $('#fd_tabcontrol-0').tabs('option', 'active', LASTDIGIT); is the number of your tab in your tab control, starting from 0. So, if you 'Status' tab is the third tab, then $('#fd_tabcontrol-0').tabs('option', 'active', 2); would open it.

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests