Lucero Madrid
Lucero Madrid

Reputation: 3

How to get / use the name of 2 widgets and use them in a function?

I'm trying to set up a function to hide Button1 and to make Button2 visible.

So far I can hide Button1 as I've written the following code in the Script Section:

function nextButton(Button1) {
     Button1.visible = false;
}

In the OnClick event of Button1 I wrote:

nextButton(widget);

What I'm trying to do is to send Button2 to the function. I tried the following:

OnClick event: nextButton2(widget, Button2);
Script:  function nextButton(Button1, Button2) {
     Button1.visible = false;
     Button2.visible = true;  }

This way when I click on Button1 it would hide and Button2 will appear. But it seems that sending the name of the object (Button2) is not working.

Do you know how I can reference another object and send it to the function?

Upvotes: 0

Views: 63

Answers (1)

TheMaster
TheMaster

Reputation: 50644

You should get the Button2 element from the global variable app.

var Button2 = app.pages.PageWithTheButton.Button2; //Assuming the button is directly in the page.

Upvotes: 1

Related Questions