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

How to stop PDF to save changed when validation fails

nmc091
Registered: Jan 13 2009
Posts: 15

Hi,

I have one mandatory field in my PDF form and whenever the user tries to save without any data on that mandatory field I issued a javascript pop up alert message "Signature is blank". But the problem is the PDF is continues to save the changes made by the user.

Is there any script that stops the saving when a validation fails? Thanks in advance for the time and inputs.

Regards,
Marc

radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
If the users saves the form from Acrobat/Readers menu, you can't abort the save process.
But you can design an own save button in the form with an if-condition that checks all mandatory fields and when the validation was ok, the form can be saved.

EXAMPLE:

if (TextField1.rawValue == null ||
TextField2.rawValue == null)
{
app.alert({cMsg:"Fill out all requiered fields!",cTitle: "Requiered information missing", nIcon: 1, nType: 0} );
}
else
{
event.target.mySaveDoc(event.target);
}

To avoid the user uses save/saveAs from the menu you can hide the menu bars with a JS in the forms initial event

app.toolbar = false; // Hide the toolbar
app.menu = false; // Hide all menus

To show the menu the user then has to press F8 and/or F9 first.

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs