Need help to hide a tab

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
oren944
Posts: 8
Joined: Wed Feb 04, 2015

04 Feb 2015

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();

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

05 Feb 2015

Please, try the following code:

Code: Select all

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
Posts: 8
Joined: Wed Feb 04, 2015

05 Feb 2015

Thank you ! This worked.

oren944
Posts: 8
Joined: Wed Feb 04, 2015

05 Feb 2015

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.

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

06 Feb 2015

Hi,

Just add conditions for other options to the code:

Code: Select all

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();

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest