Tabs & Javascript

rss

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 Kozlov
    Dmitry Kozlov
    Admin
    Member for: 9 years 8 months 16 days
    #1 by Dmitry Kozlov May 23 ’14 at 10:39

    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

  • apawar
    Member
    Member for: 9 years 16 days
    #2 by apawar May 23 ’14 at 02:50

    Thanks, that worked.

  • JHMark
    Member
    Member for: 10 years 23 days
    #3 by JHMark Jul 1 ’14 at 09:40

    [#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 Kozlov
    Dmitry Kozlov
    Admin
    Member for: 9 years 8 months 16 days
    #4 by Dmitry Kozlov Jul 3 ’14 at 06:52

    [#3]: Please, find a sample in the following thread:

    http://forum.spform.com/forms-designer-for-sharepoint-20/expand-accordion-25187/#msg5

  • Terry Tang
    Member
    Member for: 8 years 2 months 13 days
    #5 by Terry Tang Mar 27 ’15 at 04:09

    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 Kozlov
    Dmitry Kozlov
    Admin
    Member for: 9 years 8 months 16 days
    #6 by Dmitry Kozlov Mar 30 ’15 at 05:55

    [#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]);

  • JoseAdam11
    Member
    Member for: 6 months 11 days
    #7 by JoseAdam11 Nov 27 ’22 at 06:29

    "Tab" is a rebuttal. "They are indent-only characters. Developers with essay typer different indent size settings can change the look of the code without changing the code.

  • marylewin
    Member
    Member for: 6 months 2 days
    #8 by marylewin Dec 6 ’22 at 02:16

    Do you know about Chemistry Assignment Help? there are many assignments service provider. If you need any type of assignment help then you can visit this site BookMyEssay which is on the top these days.

  • tommy
    Member
    Member for: 4 months 21 days
    #9 by tommy Jan 17 ’23 at 12:37

    [#5]:

    Yes, this is a known issue. The best way to address this is to use JavaScript to reset the tab selection when a filter is changed. You can use a combination of the onchange event and the JavaScript setAttribute() method to reset the tab selection to a default tab when the filter is changed. Here is an example: document.getElementById('filter').onchange = function() { document.getElementById('tab1').setAttribute('selected', true); }; For any kind of information you can also contact me. I will do my best to guide you.

  • tommy
    Member
    Member for: 4 months 21 days
    #10 by tommy Jan 17 ’23 at 12:40

    [#9]:

    More you can also join our gb whatsapp group where we teach you about javascript and many other languages. In this group, we will update the latest information.


     

     

     

Displaying 1 to 10 of 16 messages
Previous12