How to Add a Calculation Formula to a PDF Form Field in Adobe Acrobat
Question details
The user needs to configure a PDF form field to automatically calculate a mathematical result based on values entered into other input fields.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form (like an invoice, order form, or grading sheet) that requires automated data calculation.
- Observed behavior
- The user wants to apply a custom JavaScript formula to read input fields, calculate the final result, and assign it to a designated calculated field.
Make sure you have noted the exact names of the input fields you plan to use in your formula, as JavaScript is case-sensitive and requires exact field name matches to function properly.
Add a Custom JavaScript Calculation Formula
Use the Field Properties menu to assign a custom JavaScript calculation to your result field, allowing you to process multiple variables dynamically.
Acrobat form calculations are executed through the field's Calculate action. By using a Custom calculation script, you can handle complex math, apply specific formatting, and prevent errors caused by empty input fields.
Open your PDF in Acrobat's form editing mode. Create a new text field where you want the final calculated result to appear.
Double-click the new field to open the Text Field Properties dialog. Go to the General tab and check the 'Read Only' box so users cannot manually overwrite the calculation.
Click on the 'Calculate' tab within the Properties dialog, then select the 'Custom calculation script' option.
Click the 'Edit' button and input your JavaScript formula. For example, to multiply fields and sum them up: var v1 = Number(getField("box1").value) || 0; var v2 = Number(getField("box2").value) || 0; event.value = 0.9 * (v1 * 32.9 + v2 * 67); Replace 'box1' and 'box2' with your actual field names.
Click 'OK' to close the JavaScript editor, then click 'Close' on the Properties dialog. Preview your form and enter numbers into the input fields to verify the calculation works.
Create and Manage PDF Forms Easily with WPS Office
WPS Office offers a comprehensive and lightweight PDF toolset that allows you to easily view, edit, fill, and create interactive PDF forms without the steep learning curve or heavy subscription fees.
- 1. Open PDF Tools: Launch WPS Office and open your PDF document using the built-in PDF reader.
- 2. Access the Form Tab: Navigate to the 'Form' tab on the top ribbon to access interactive form creation tools.
- 3. Insert Form Fields: Select 'Text Field' or 'Checkbox' and click on the document to place the interactive elements.
- 4. Configure Properties: Double-click the inserted field to open the properties panel, where you can rename the field and adjust its appearance.
- 5. Save and Share: Save your document. The interactive form can now be filled out by any user with a standard PDF reader.

Frequently Asked Questions
Can I perform basic math without using JavaScript in Acrobat?
Yes, for basic calculations. In the Calculate tab of the Field Properties, select the 'Value is the' option. From the dropdown menu, you can choose sum, product, average, minimum, or maximum, and then click 'Pick' to select the input fields you want to calculate.
Why is my PDF form calculation not updating automatically?
This usually happens due to an incorrect calculation order. If field A relies on field B, field B must be calculated first. Go to Tools > Prepare Form > More > Clear Form, then check the 'Calculate Order' option under the More menu to rearrange the sequence.
How do I format the calculated result as currency?
Open the calculated field's Properties, navigate to the 'Format' tab, select 'Number' from the Select format category dropdown, and then choose a currency symbol and set the decimal places.
What happens if a user inputs text instead of numbers into the calculation fields?
If text is entered, the JavaScript calculation may fail or output 'NaN'. To prevent this, go to the Format tab of the input fields, select 'Number', and restrict the input so users can only type numerical values.




