Expand my Community achievements bar.

SOLVED

javascript if statement

Avatar

Level 2

Hello,

I am not good at javascript so I got this button "Save as..." and a javascript messagebox comes up asking if they secure the document before save it:

xfa.host.messageBox("WARNING", "Did you secure the document prior saving it?", 3, 2);

If they say 3 (yes), the javascript code should be apply: app.execMenuItem("SaveAs");

If 2 (no), go back to the document. Anyone can help?

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 7

OK, here's working script.

btnSaveAs::click

if (xfa.host.messageBox("Did you secure the document prior to saving it?", "WARNING",2,2) == 4) app.execMenuItem("SaveAs");

View solution in original post

3 Replies

Avatar

Level 7

Something like this, probably:


if (xfa.host.messageBox("WARNING","Did you secure the document prior to saving it?",3,2) == 3) app.execMenuItem("SaveAs");


Avatar

Level 2

Still gives me the option to save as if I click option 2.

Avatar

Correct answer by
Level 7

OK, here's working script.

btnSaveAs::click

if (xfa.host.messageBox("Did you secure the document prior to saving it?", "WARNING",2,2) == 4) app.execMenuItem("SaveAs");