Hide disable a tab with a check box

rss

Posted by jpwallace - Mar 6 ’17 at 09:02

Hi,

I would like to enable a tab when a check box is ticked and when unticked the tab is disabled. I have seen;

if (fd.field('CheckboxField').value()) {
// Checked
} else {
// Unchecked
}

and http://formsdesigner.blogspot.co.uk/2013/03/how-to-create-dynamic-forms-with-forms.html

however i am unsure how to layout the correct javascript to disale/enable a tab with a check box.

I have a similar thing working else where but its not based on a check box

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 6 years 2 months 20 days
    #1 by Dmitry Kozlov Mar 7 ’17 at 04:13

    Hi,

    Try this:

     
    if (fd.field('CheckboxField').value()) {
        // Enable all tabs
        fd.tabControl(0).tabs('option', 'disabled', null)
        
    } else {
        // Disable second tab
        fd.tabControl(0).tabs('option', 'disabled', [1])
    }
    
  • jpwallace
    Member
    Member for: 2 years 11 months 3 days
    #2 by jpwallace Mar 7 ’17 at 11:06

    Hi Dimitry,

    I tried that, unfortunately it didnt work, i tried this, my Fligts tab is disabled it just doesnt enable upon checking the box.... could you point out where i have gone wrong please

     

    function setFlightsTab() {
    var v = fd.field('flight').control.().value();
    if (v == '1') {
    $('#fd_tabcontrol-0').tabs('option', 'disabled', null);
    } else {
    $('#fd_tabcontrol-0').tabs('option', 'disabled', [0]);
    }
    }
    fd.field('flight').control().change(function () {
    setFlightsTab();
    });
    setFligthsTab();

  • jpwallace
    Member
    Member for: 2 years 11 months 3 days
    #3 by jpwallace Mar 7 ’17 at 11:32

    found my error, my internal name was incorrent, thank you

     

Displaying 1 to 3 of 3 messages