Allow Manual Overrides of Calculated Fields in Adobe Acrobat Forms
Question details
The user needs an Acrobat form value to calculate automatically, accept a temporary manual override, and return to the calculation when the override is cleared.

- Product
- Adobe Acrobat forms
- Device & OS
- not provided
- Scenario
- A form calculates a result from source fields, but users sometimes need to enter a different value temporarily.
- Observed behavior
- The desired result is to show a valid override when one is entered and otherwise show the calculated value.
Open the PDF in Adobe Acrobat and make sure you can edit its form fields with Prepare a form. Identify the source fields and the formula used to calculate the result.
Use a separate override field and calculated result field
Use this approach when users need to replace a calculated value temporarily without losing the original formula.
The override field stores the user's entry, while the result field decides whether to display that entry or the calculated value. Clearing the override restores the calculation automatically.
The example below adds two source fields. Replace the field names and formula with those used in your form. For this example, enter plain numbers using a period as the decimal separator and no thousands separators.
Open All tools > Prepare a form. Add or identify text fields named SourceA and SourceB, then add separate text fields named Override and Result. Label Override so users know they can clear it to restore the calculation.
Open Result field Properties, select the Calculate tab, choose Custom calculation script, and click Edit. Enter: var a = Number(this.getField('SourceA').valueAsString); var b = Number(this.getField('SourceB').valueAsString); var text = this.getField('Override').valueAsString.replace(/^\s+|\s+$/g, ''); var override = Number(text); if (!isFinite(a)) a = 0; if (!isFinite(b)) b = 0; event.value = (text !== '' && isFinite(override)) ? override : a + b;
In the script editor, replace SourceA, SourceB, and Override with your exact field names if they differ. Replace a + b with your original calculation, then save the script and close the field properties.
Exit form editing or use Preview. Enter values in the source fields and confirm Result calculates. Enter a number in Override and leave the field; then delete the override and leave the field again to confirm the calculated result returns.

Work with PDFs and Office files in WPS Office
WPS Office is a free, lightweight alternative for everyday document and PDF work, with a familiar interface and support for common Office formats to make migration easier. Use Adobe Acrobat to configure the custom form calculation described above.

Frequently Asked Questions
Why should the override be a separate field?
A separate Override field preserves the user's entry independently from the Result field's calculation script. When Override is cleared, the script can use the original formula again.
Can I use zero as the override value?
Yes. The example checks whether the field is blank separately from checking its numeric value, so entering 0 overrides the calculation with zero.
What happens if the override is not a valid number?
With the example script, a blank or nonnumeric Override entry is ignored and Result displays the calculated value instead.
Where do I change the original calculation?
In Prepare a form, open Result field Properties > Calculate > Custom calculation script > Edit. Replace the example expression a + b with your own formula and update the source field names.




