Need help to hide a tab
Posted by oren944 - Feb 4 ’15 at 02:00
Hello,
I am trying to disable a tab until the user has chose a certain option in a drop down menu. how would i go about programming this?
This is what i have so far however it is not working...
function setPhoneTab()
{
var status = fd.field('Choose_x0020_contact_x0020_optio').control().value();
if (status == 'Letter')
{
$('#fd_tabcontrol-o').tabs('option', 'disabled', null);
}
else
{
$('#fd_tabcontrol-o').tabs('option', 'disabled', [1]);
}
}
var status = fd.field('Choose_x0020_contact_x0020_optio').control().chnage(function()
{
setPhoneTab();
});
setPhoneTab();
-
Dmitry KozlovAdminMember for: 10 years 11 days
Please, try the following code:
function setPhoneTab() { var status = fd.field('Choose_x0020_contact_x0020_optio').value(); if (status == 'Letter') { $('#fd_tabcontrol-0').tabs('option', 'disabled', null); } else { $('#fd_tabcontrol-0') .tabs('option', 'active', 0) .tabs('option', 'disabled', [1]); } } fd.field('Choose_x0020_contact_x0020_optio').change(function() { setPhoneTab(); }); setPhoneTab();
-
oren944MemberMember for: 8 years 7 months 27 days
Thank you ! This worked.
-
oren944MemberMember for: 8 years 7 months 27 days
How would I go about doing more than one tab like that? for example i have multiple tabs aa drop down menu. once the user selects a option then that tab is now availble to be clicked on.
-
Dmitry KozlovAdminMember for: 10 years 11 days
[#3]: Hi,
Just add conditions for other options to the code:
function setPhoneTab() { var status = fd.field('Choose_x0020_contact_x0020_optio').value(); switch (status) { case 'Option 1': $('#fd_tabcontrol-0') .tabs('option', 'active', 0) .tabs('option', 'disabled', [2]); break; case 'Option 2': $('#fd_tabcontrol-0') .tabs('option', 'active', 0) .tabs('option', 'disabled', [1]); break; default: $('#fd_tabcontrol-0') .tabs('option', 'active', 0) .tabs('option', 'disabled', [1, 2]); break; } } fd.field('Choose_x0020_contact_x0020_optio').change(function() { setPhoneTab(); }); setPhoneTab();