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

how to verify form successful submission before next action performed

SunnyOz
Registered: Feb 8 2008
Posts: 7

I have a PDF form that has some required fields. On the submit button property - action tab - I am using the trigger 'Mouse UP', and it has the 'Submit a form' action (to send the eMail).

If the user tries try to submit the form without some of the required fields, it gives an error and highlights all the required fields.

All that works great by itself.

HOWEVER, I have recently added a 'Run a JavaScript' action - that executes after the 'submit a form' action. This new javascript checks one of the fields entered and directs the user to a new page depending on what they selected.

And that by itself works great (thanks to help from thomp).

MY PROBLEM is that now that I have added the javascript - if the user tries to submit the form with any MISSING required fields, then the form gives you the error message, highlights the missing fields, BUT THEN proceeds to process the javascript and it takes the user to a webpage depending on what they did (or did not) enter in the field the script was checking.

IS THERE ANY WAY that I can check first to make sure that the form has been SUCCESSFULLY submitted (ie: All required fields have been entered, and the PDF creates the eMail to send the form results out), before I start executing the next action (ie: my javascript to take them to another page)?

Any help will be greatly appreciated!
SunnyOz

My Product Information:
Acrobat Pro 8.0, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Unfortunately you can't. You need to either decouple going to the web page from the submit action, or do the validation and submit in JavaScript where you can control the flow of actions.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

SunnyOz
Registered: Feb 8 2008
Posts: 7
What a pity! OK.. I don't think I can put the javascript to run anywhere else (other than attached to the submit button) to ensure that it only occurs after the eMail is sent out (upon pressing the submission button).

So if I wanted to pursue adding this feature (which I would really like to do), then it appears that the only choice would be to duplicate the PDFs submit form action within the javascript as you suggested.

Except, I DON'T KNOW HOW to do that in PDF. Has anyone done this before that would be willing to share their code with me (and the rest of the community?)

Basically all I need to do is check on required fields (and return the user to the form to finish input if they have left any of those fields blank - and maybe highlight them like the form does currently), and then if the required fields have all been filed in correctly, to create a PDF (with all the responses).. and attach it to an eMail.

Is there some standard javascript code I can reference for this normal PDF form submit function?

Thanks again!
SunnyOz
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
To start, you can read this article:

http://www.acrobatusers.com/tech_corners/javascript_corner/tips/2006/submitting_data/

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

cl5792
Registered: Jul 17 2008
Posts: 53
This article is no longer available. Is there another link that could be used.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Here it is,

http://www.acrobatusers.com/tutorials/2006/submitting_data

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script