Need help to hide a tab

rss

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 Kozlov
    Dmitry Kozlov
    Admin
    Member for: 10 years 11 days
    #1 by Dmitry Kozlov Feb 5 ’15 at 04:23

    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();
    
    
  • oren944
    Member
    Member for: 8 years 7 months 27 days
    #2 by oren944 Feb 5 ’15 at 01:28

    Thank you ! This worked.

  • oren944
    Member
    Member for: 8 years 7 months 27 days
    #3 by oren944 Feb 5 ’15 at 03:55

    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 Kozlov
    Dmitry Kozlov
    Admin
    Member for: 10 years 11 days
    #4 by Dmitry Kozlov Feb 6 ’15 at 05:24

    [#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();
    
Displaying 1 to 4 of 4 messages