PDF Editing Issues

Override Calculated Acrobat Form Fields and Append JavaScript Values

Elise WilliamsElise Williams Nov 19, 2026 868 views

Question details

The user wants to manually override a calculated Acrobat form field and append the sum of two field values to text.

Override Calculated Acrobat Form Fields and Append JavaScript Values
Product
Adobe Acrobat form fields
Device & OS
not provided
Scenario
A PDF form uses a custom calculation to combine descriptive text with values from two fields.
Observed behavior
Manual changes to the calculated field are reset when its calculation runs.
Before you start

Open the PDF in Adobe Acrobat and use Prepare a form to check the exact names of the calculated field and its source fields. Confirm that the calculated field is not marked Read Only in its properties.

Solution 1Recommended

Add a manual override checkbox and update the calculation script

Use a checkbox to cancel the calculation when you want to edit the result manually, and use the plus operator to append the numeric sum to text.

1
Create the override checkbox

In Acrobat, open Prepare a form, add a checkbox, and name it ManualOverride in its properties. Leave it unchecked when the field should calculate automatically.

2
Open the calculation script

In Prepare a form, open the calculated field's Properties, select Calculate, choose Custom calculation script, and click Edit.

3
Enter the script

Replace the calculation script with the following, adjusting field names as needed: if (this.getField("ManualOverride").value !== "Off") { event.rc = false; } else { var v1 = Number(this.getField("StrMod").value); var v4 = Number(this.getField("FatMod").value); var total = v1 + v4; var text = "2d8 slashing; 1d10 acid; 3d6 versus evil "; if (this.getField("Enlargecb").value === "Off") { text = "1d10 slashing; 1d6 acid; 2d6 versus evil "; } event.value = text + total; }

4
Test both modes

Close the field properties and preview the form. With ManualOverride unchecked, change StrMod or FatMod and check the result. Check ManualOverride, enter a manual value in the calculated field, and test that it remains when other fields change.

Add a manual override checkbox and update the calculation script
Check field names and values: The example assumes StrMod and FatMod contain numeric values and that Enlargecb is a checkbox whose unchecked value is Off. Remove or adjust the Enlargecb condition if your form uses a different field. Non-numeric source values can produce NaN.
Free Microsoft Office alternative

Work with PDFs and Office documents in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and Office documents. Its format compatibility helps you move existing files into your workflow. It does not fix Acrobat's calculation scripts, and support for Acrobat-specific form JavaScript may differ.

View PDFs alongside other documents in one applicationOpen and edit compatible Microsoft Word and Excel files, including DOCX and XLSXUse a familiar interface that makes moving from Microsoft Office easierGet started with a free, lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why does my manual entry disappear from a calculated field?

The field's calculation can run again when form values change and replace the manual entry. In the field's Properties, use Calculate > Custom calculation script to add a condition that cancels the calculation while manual override is enabled.

How do I append a calculated number to text in Acrobat JavaScript?

Convert the source values with Number(), add them, and use the plus operator to join the result to a string. For example, event.value = "Total: " + (Number(a) + Number(b));.

What does event.rc = false do in the calculation script?

It cancels the current calculation event instead of applying a new calculated value. Place it in the branch that runs when the ManualOverride checkbox is checked, then test manual editing in the form.

Why does the calculated result say NaN?

One or both source fields may contain text that Number() cannot convert. Check the values in StrMod and FatMod, and enter numeric values before testing the calculation again.