Page 1 of 1

Focus on different tabs for different views

Posted: 03 Sep 2015
by Lucila Mortara
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,

Re: Focus on different tabs for different views

Posted: 04 Sep 2015
by rostislav
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.