Answered
I am trying to insert a Java Script within a form that will validate required fields before allowing an electronic signature. I have placed the script inside the signature field properties however it only executes after the document has been signed.
Where do I need to put this script so that it will validate the field data BEFORE applying the electronic signature?
Any help would be greatly appreciated.
Thanks, Sarah
1. The easiest way is to create a validate button that runs code for validating the fields and then shows/enables the signature field on a positive result. On a negitive result, use a popup to let the user know they need to change somthing.
You could extend this method to actually start the signature process so the user doesn't have to actually click on the signature field. You wouldn't even have to enable the signature field. Just label the button as "Sign Form"
2. A slightly trickier method is to place an invisible button(that does the same thing as 1) over top of the signature field. The signature field would need to be ReadOnly. When the user clicks on the signature, they are really clicking on the button. You need to set the fields up in the right order to do this.
If you want to show the signature as disabled, here's an article on how to do it.
http://www.acrobatusers.com/tutorials/2007/js_disabling_fields/
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script