Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

javascript if statement

herveys81193086
Level 2
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
jasotastic81
Correct answer by
Level 7
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
jasotastic81
Level 7
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");


herveys81193086
Level 2
Level 2

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

jasotastic81
Correct answer by
Level 7
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