Fix Acrobat JavaScript Reading an Old PDF Form Field Value
Question details
The user needs an Acrobat form button to read the latest text field value before emailing the PDF.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- A user edits the final text field and immediately clicks a button that runs JavaScript to email the PDF.
- Observed behavior
- The button script may read the field's previous value because the latest entry has not yet been committed.
Open the PDF in Acrobat and make sure you can edit its form fields. Identify the email button and the text field whose latest value is being missed.
Move the email button script to the Mouse Up event
Use Mouse Up instead of Mouse Down so Acrobat can commit the latest field entry before the email script runs.
In Acrobat, open the PDF and select Prepare a Form from the tools.
Double-click the email button, open the Actions tab, and check whether the JavaScript action is assigned to the Mouse Down trigger.
Select the Mouse Down JavaScript action and click Edit. Copy the script, close the editor, and remove that action. Select Mouse Up as the trigger, choose Run a JavaScript as the action, click Add, and paste the script.
Close the button properties, save the PDF, and exit form editing. Change the last text field and immediately click the email button; check that the script uses the new value.

Work with PDFs and Office files in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and Office documents. It supports common Microsoft Office formats for easier migration, but it does not change Acrobat's JavaScript event behavior.

Frequently Asked Questions
Why does my button read the previous text field value?
A script assigned to Mouse Down may run before Acrobat commits the latest text entry. Check the button's Actions tab and move the JavaScript to Mouse Up.
Where can I find the button's JavaScript?
Open Prepare a Form in Acrobat, double-click the button, and select the Actions tab. Select the JavaScript action and click Edit to view its code.
Do I need to change the mailDoc() code?
Not necessarily. If the script is assigned to Mouse Down, first move the existing script to Mouse Up and test it after editing the last field.
What should I check if Mouse Up does not fix the value?
Confirm that the script references the correct field, then inspect that field's validation and calculation scripts in its properties. Test again after saving the form.




