These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Reader - Prompt before saving

highburycottage
Registered: Dec 16 2009
Posts: 5

Hi,

I have a form that our users complete, then print, but do not save. Some of them have closed the form down before printing. As I have hidden the menu buttons (they are builders, who dont use their pcs much), they lose all the information.

Is there away I can ask them if they are really ready to close the document. So far I can get the close element to work, but when they click cancel it still closes. I am doing this on the javascript option document action - when document closes: - I do not want them to be able to save the file or be given the option to save the file.

The code I have so far is:

var cMsg = "Are you ready to close this form?"
var nRtn = app.alert(cMsg,1,2);
if(nRtn == 3)
{ // A Yes Answer
// Just close the form
event.target.dirty = false;
}
else if(nRtn == 2)
{ // A No Answer
// Do not close the document
event.target.close = false; - THIS IS WHERE I AM STUCK
}

Have spent a few hours looking but to no avail - could somebody please help me, or guide me in the right direction. Much appreicated.

My Product Information:
Reader 8.0, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2399
You can't prevent a user from closing the document.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

highburycottage
Registered: Dec 16 2009
Posts: 5
No thats ok, they can close the document - I just want to warn them that if they do, they will lose all the information they have input to the document. So they get the warning message. Do you wish to close - Yes - the document closes - no I haven't finished clicked in error - return to the document - that is the bit I am struggling with. Its just a couple of the users have closed the document without printing it - and have had to complete the form again - which as you can imagine takes a non computer user ages to complete. Its not a problem if it cannot be achieved, its just to help them and hopefully save them having to do it again.
try67
Expert
Registered: Oct 30 2008
Posts: 2399
Let me rephrase: once a user closes the document in some way, you can't stop it from being closed.
The only thing you can do is save it with a script before it closes.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Once you start the close process, the 'Will Close' wil not let you cancel the close, but you could add a script to prompt for the print as part of the 'Will Close' action.
var cMsg = "You have not printed your form!\nYou will lose your data!\n\nDo you want to print it now?"var nRtn = app.alert(cMsg,1,2);if(nRtn == 4){ // A Yes Answerthis.print();}

A saving script has some special security restrictions and is a bit harder to code because you need to have an application folder script that must be installed on each user's computer.

George Kaiser

highburycottage
Registered: Dec 16 2009
Posts: 5
try67 - I understand where you coming from now - thanks. and gkaiseril - thanks for that - I will utilise that code.

Thanks again.