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

Validate Required Fields Prior to Applying Electronic Signature

srprice
Registered: Sep 19 2007
Posts: 138
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

My Product Information:
Acrobat Pro 8.1.2, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
There are a couple of ways to do this. In both methods you have to hide or disable the signature field so the user can't click on it.

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

srprice
Registered: Sep 19 2007
Posts: 138
Thanks for the response this was a big help.

I have created a sign form button that validates the required fields and upon validation it will add a signature field in the appropriate location.

You mentioned in your post that you could extend this method to actually start the signature process, this is what I would like to do but can't seem to find the correct code to make that happen.

Can you point me in the right direction??

Thanks again for all your help.

Sarah
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
I was thinking of the "field.signatureSign()" function, but after looking it up in the Acrobat JavaScript Reference its apparent that it can't be run from inside a document script. This function can siliently sign a document or initiate the signing process, depending on the input parameters. But it requires a privileged context.

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