Skip to main content
Known Participant
March 8, 2018
Answered

another popAlert question

  • March 8, 2018
  • 1 reply
  • 1133 views

I'm using this script to alert the user to click a button:

if (this.calculate) app.alert("Please click the ''On'' button before proceeding.\n\n**Note:\nThis alert will appear whenever the ''On'' button is not clicked\n\nBe sure to click the ''Off'' button when you are ready to perform your calculations.\n",3);

What I'd like to know is, is it possible to use the OK button in the alert to set (click the Button2) when the OK is clicked to close the popAlert window. I have two buttons that hide and show when clicked. Button2 is visible and when I click it, it hides and shows Button4. It's just to turn on then turn off. So, would it possible to use the OK button to click Button2, hide it, and show Button4? Then they can click Button4 for themselves when they are ready to. It would help streamline that process of turning the buttons on/off for the user.

This topic has been closed for replies.
Correct answer try67

Would the scripts in your second reply above still be needed?


If you want to do the same thing from two locations, yes.

Then you can do something like this:

if (app.alert("Hello!",3,1)==1) {

     mouseUpA();

}

1 reply

try67
Community Expert
Community Expert
March 8, 2018

No, you can't emulate clicking a button with a script. What you can do, though, is have that button call a function that does all the things that should happen when it is clicked, and then call that same function from your other code.

pdfUser1Author
Known Participant
March 8, 2018

Thanks for responding. The only thing is, is I wouldn't know how to do what you're saying. Would you be able to show me with a little example? If it's not too much trouble. I'd really like to see how it would be done. Thanks, try.

try67
Community Expert
Community Expert
March 8, 2018

Create a doc-level script:

function mouseUpA() {
     app.alert("Hello!");
}

As the MouseUp event of field A enter:

mouseUpA();

Then as the MouseUp event of another field you can use:

if (this.calculate) mouseUpA();