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

Can I detect an update to a field?

CarolinaPower
Registered: Mar 26 2009
Posts: 43

For example if a user goes back with mouse selects date and changes it?

My Product Information:
Acrobat Standard 9.1, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You can setup a script that will detect changes. The best way to do this is to create two document level fucntions, one to save the current state of the fields of interest and one to test for changes. Call the save function when the document is opened, and then call the compare function whenever you want to detect a change.

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]

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

CarolinaPower
Registered: Mar 26 2009
Posts: 43
Do I need to create hidden fields to store the value of the form fields?

And when I'm comparing actual contents with stored value, how do I zero in on just those fields that have changed? I assume there is an iterative routine that compares current with saved state.

Any example code floating out there???? It's a common challenge.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You could use a hidden field, but it's unnecessary since you don't need to save this information in the form. A document level generic object will work fine.

But the technique I'm talking about is for detecting general changes in the PDF and I doubt you'll find a script for this floating around because this is not a common task. But maybe this is not what you are looking for.

If you are looking for changes in a single field, then you can do this with Validate or Format script. These events will only fire when a field has been changed. If you need the previous value then use the OnFocus event to save the current field value to a document level variable.

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]

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