Expand my Community achievements bar.

Elevate your expertise and be recognized as a true influencer! Nominations for the exclusive Adobe Community Advisor program 2023 are now OPEN.

Question about execmenuitem and xfa.host.print dialog boxes

Avatar

Level 1

I have two buttons on my form.  One saves the form and one prints the form.  Following those commands are lines of code to mark the form readonly:

Printer Button

xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 0, 0, 0, 0)

this.resolveNode("header.DateTimeField1").access = "readOnly";

etc...

----------------------------------------------------------------------------------------------------

SaveAs Button

app.execMenuItem("SaveAs");

this.resolveNode("header.DateTimeField1").access = "readOnly";

etc....

My question is, how can I evaluate what button they pressed from the save/print dialog boxes.  Currently, if they press the Save button, the save dialog box comes up and if they hit save it saves it and makes the whole form as read only.  If they Save and then press cancel, it doesn't save and still marks the whole form as readonly.  Same goes for the printer dialog box.  Thoughts?

1 Reply

Avatar

Level 10

Hi,

This has come up before.

You could use a post event (postSave or postPrint), but you will have the same trouble. If the user cancels the save/print, the relevant post event will still fire.

This is because the pre/post events, like preSave and postSave, are a pair.

Thinking about it, does the user appreciate that if they click the save or print button, that the form will actually lock? Will they get a nasty surprise after printing the form, that they can no longer edit it?

One posible solution would be to have a single button visible "Finish and lock this form", with a suitable tooltip. In the click event the script would lock the form, hide the "Finish" button and show the "Save" and "Print" buttons.

Would that work?

Niall