Page 1 of 1

If doesn't work if i do it on new tab

Posted: Tue Feb 13, 2018 11:23 pm
by ALD Automotive
Hello,
I created simple form for creating a users at AD. it's works correctly, but if i add Tab control and put this script at second tab sript doesn't work

Code: Select all

if (($combobox1_Department.SelectedItem -eq "Sales") -or ($combobox1_Department.SelectedItem -eq "Operations") -or ($combobox1_Department.SelectedItem -eq "Accounting"))
	{
		$combobox_City.Visible =$true
		$labelГород.Visible = $true
	}
	else
	{
		$combobox_City.Visible = $false
		$labelГород.Visible = $false
	}
What's i do wrong?

Re: If doesn't work if i do it on new tab

Posted: Tue Feb 13, 2018 11:42 pm
by jvierra
Not enough information. Where did you put it on the tab? What event is it in?

Re: If doesn't work if i do it on new tab

Posted: Wed Feb 14, 2018 1:15 am
by ALD Automotive
Ok, i have a script (disinger in attachment). Some later i want add Tab control and at second tab write new script.
(second attachment). If i use scripts alone both works fine. But if i put second script at TAB control (page #2) it's doesn't work.
What doesn;t wokr: When i select departments (if i select accounting, operations or Sales) must be do visible new combobox $combobox_City. And it's doesn,t work.

Re: If doesn't work if i do it on new tab

Posted: Wed Feb 14, 2018 1:36 am
by jvierra
None of this explains how you are executing the code. What event are you placing the code in?

Re: If doesn't work if i do it on new tab

Posted: Wed Feb 14, 2018 7:15 am
by ALD Automotive
I have a control combobox. Event - SelectedIndexChanged.
If i select some values in this combobox - another combobox be visible (by default it's invisible).
It's work fine at alone form. But if i add to another form control - "Tab control" and at Page2 make same control from first form (same name) and make same script code, this action (visible or invisible) doesn't work.

Re: If doesn't work if i do it on new tab

Posted: Wed Feb 14, 2018 5:09 pm
by jvierra
We cannot be of any help from simple statements about your code.

You cannot have two controls with the same name in the same container. The variable for the tab version will be different from the first one you created. Find the correct control variable and it should work.