on 07-30-2015 7:42 PM
Is there a way to stop a script - mid script within an if statement?
For example - if I want to have a single button which hides and shows a controls
if controlA = hidden
then show controlA
exit
if controlA = visible
then hide controlA
exit
without those stops the button hides, then immediately shows the controlA
Hi Shane,
I am not sure if you are using 2.0 or 3.0
As Tamas has already given 2.0 solution.
In 3.0, you can use the control.visible option to implement the the logic you described above.
You can create a script button and attach the code:
if (controlA.visible == false)
controlA.visible = true;
if (controlA.visible == true)
controlA.visible = false;
--
Regards
Saurabha J
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is no specific way to stop a script in an IF statement, but the described task can be solved with two script buttons.
Do this:
Your primary script button should check whether the targeted control is visible and if it is, hide it. In addition, the IF block also should set a JavaScript variable in this case.
Then have a second IF statement which checks whether the JS variable is set and if it isn't, then pushes the second script button.
The second script button will check if the control is hidden and if it is, shows it.
Then you hide the second script button of course.
Now you can click on the first script button which will toggle the control being hidden / visible.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try inserting alert statements for debugging
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.