PDF Editing Issues

Fix Acrobat Document-Level JavaScript Calculation Functions

Khadija KhanKhadija Khan Nov 19, 2026 868 views

Question details

The user needs two document-level JavaScript functions to calculate and update Acrobat form fields.

Fix Acrobat Document-Level JavaScript Calculation Functions
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.
Before you start

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.

Solution 1Recommended

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.

1
Open the console

Open Acrobat's JavaScript Console with Ctrl+J on Windows or Command+J on macOS, then trigger the calculation by changing an input field.

2
Inspect reported errors

Read the console output for syntax errors, undefined functions, or runtime errors, and correct the indicated script or line.

3
Verify function definitions

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.

4
Check field names

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").

Check JavaScript Errors and Document-Level Functions
Tool names may vary: The location of JavaScript and form-editing tools can vary by Acrobat version. Look for them under All tools or Tools.
Free Microsoft Office alternative

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.

Open and work with PDF documents alongside other filesCompatible with Microsoft Office formats including DOCX, XLSX, and PPTXFamiliar interface for a straightforward transitionFree, lightweight tools for everyday document work
QA img-9

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.