Answered
Hello! I have a field that pulls from another field using getField (code below). But I want users to be able to overwrite the data. I'm thinking this is an if statement, but don't know how to script it.
event.value = this.getField("FieldName").value
Thanks!
What you have to do is detect user entry, and then use this info to block the calculation.
Use the Keystroke Script:
Now, in the calculation script
If the user enters data into the field it sticks, but if they delete everything from the field it reverts back to the calculation.
The code will work while the PDF is open. However, the state data (event.target.bDetect) is lost when the PDF is closed. If you want to maintian the calculation override this data will have to be saved with the form and restored when it is reopened.
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