Tabs & Javascript
Posted by apawar - May 23 ’14 at 07:30
Hello,
I have 5 tabs in my form design, I would like to disable 4 tabs until the "Assigned To" user changes PromoStatus to "Approved" or "Complete"....
I am using the following JS code, to disable the 4 tabs, however only the last (ie., 1 gets disabled, the others are still enabled, please help
_________________________________________________
function setMerchTab(){
var v =fd.field('PromoStatus').control().value();
if (v=='Approved' || v=='Complete')
{
$('#fd_tabcontrol-0').tabs('option', 'disabled', null); // Enable
} else {
$('#fd_tabcontrol-0').tabs('option', 'disabled', [4]); // Disable
$('#fd_tabcontrol-0').tabs('option', 'disabled', [3]); // Disable
$('#fd_tabcontrol-0').tabs('option', 'disabled', [2]); // Disable
$('#fd_tabcontrol-0').tabs('option', 'disabled', [1]);//Disable
}
}
fd.field('PromoStatus').change(function(){
setMerchTab();
});
setMerchTab();
________________________________________
Thanks
Avi
-
Dmitry KozlovAdminMember for: 8 years 7 months 25 days
Hello,
You should pass indices of tabs which you wish to disable in a single array:
$('#fd_tabcontrol-0').tabs('option', 'disabled', [1,2,3,4]); // Disable
-
apawarMemberMember for: 7 years 11 months 24 days
Thanks, that worked.
-
JHMarkMemberMember for: 9 years
[#2]: What if requirement is as follows:
If answer question A is "No", then disable tab A
If answer question B is "No", then disable tab B
If answer question C is 'No", then disable tab C
Then for answer "Yes", enable the corresponding tab.
-
Dmitry KozlovAdminMember for: 8 years 7 months 25 days
[#3]: Please, find a sample in the following thread:
http://forum.spform.com/forms-designer-for-sharepoint-20/expand-accordion-25187/#msg5
-
Terry TangMemberMember for: 7 years 1 month 19 days
Hi,
I have an issue in regards to disabling tabs. The disable works if the tab was not selected, only issue is if I selected tab then do a filter change, the tab doesn't disable at all.
Is this a known issue, and is there a solution where it removes the selection or places it on a default tab selection?
-
Dmitry KozlovAdminMember for: 8 years 7 months 25 days
[#5]: First, you should switch a tab:
$('#fd_tabcontrol-0').tabs('option', 'selected', 0);
Then disable an inactive tab:
$('#fd_tabcontrol-0').tabs('option', 'disabled', [1]);