Override Calculated Acrobat Form Fields and Append JavaScript Values
Question details
The user wants to manually override a calculated Acrobat form field and append the sum of two field values to text.

- 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.
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.
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.
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.
In Prepare a form, open the calculated field's Properties, select Calculate, choose Custom calculation script, and click Edit.
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; }
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.

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.

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.




