Fix Acrobat Document-Level JavaScript Calculation Functions
Question details
The user needs two document-level JavaScript functions to calculate and update Acrobat form fields.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- A custom calculation script calls two document-level functions in a PDF form.
- Observed behavior
- The calculated fields do not update as expected.
Open the PDF in Acrobat and identify the calculated field, its custom calculation script, and the two document-level functions it calls. Make sure JavaScript is enabled in Acrobat's JavaScript preferences.
Check JavaScript Errors and Document-Level Functions
Use Acrobat's JavaScript Console to find errors and verify that the calculation script can call the intended functions.
Open Acrobat's JavaScript Console with Ctrl+J on Windows or Command+J on macOS, then trigger the calculation by changing an input field.
Read the console output for syntax errors, undefined functions, or runtime errors, and correct the indicated script or line.
Open Acrobat's JavaScript tools and choose Document JavaScripts. Confirm that both functions are defined at the document level and that their names match the calls in the custom calculation script.
Open Prepare a form and compare each referenced field name with the actual name in the field's properties. Correct spelling and capitalization in calls such as this.getField("FieldName").

Review Calculation Results, Field Order, and Dates
Use this approach if both functions run but the final field value is missing or incorrect.
Work With PDFs and Office Files in WPS Office
WPS Office is a free, lightweight alternative for everyday PDF and Office work, with a familiar interface and format compatibility that makes moving between files straightforward. Acrobat-specific JavaScript calculations should still be tested and fixed in Acrobat.

Frequently Asked Questions
Where can I see errors from an Acrobat calculation script?
Open the JavaScript Console with Ctrl+J on Windows or Command+J on macOS, then change a form input to trigger the calculation. Review the console for syntax and runtime errors.
Why does only the second function's result appear?
Both functions may be writing to the same field or event.value. Review the field's custom calculation script and combine the results or write them to separate fields as appropriate.
How do I change the calculation order of PDF fields?
Open Prepare a form, choose More, and select Set field calculation order. Place fields that supply values before the fields that depend on them.
Can an incorrect date format stop a calculation?
Yes. If the parsing format does not match the entered date, the script may produce an invalid result or an error. Check the input format and the format string used by the parsing function.
Can WPS Office repair Acrobat document-level JavaScript?
WPS Office can be used for general PDF work, but Acrobat-specific JavaScript calculations should be debugged in Acrobat using its JavaScript Console and form tools.




