cancel
Showing results for 
Search instead for 
Did you mean: 

Screen Personas - Stop a script

shane_kelly2
Participant
0 Kudos

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

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

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

tamas_hoznek
Product and Topic Expert
Product and Topic Expert
0 Kudos

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.

sivaganesh_krishnan
Contributor
0 Kudos

try inserting alert statements for debugging