PDF Editing Issues

Fix Acrobat PDF Calculation Errors Caused by Text Values and Field Formatting

Jason MillerJason Miller Nov 24, 2026 868 views

Question details

Fix a PDF form calculation that produces a field format error when input values differ by a small amount.

Fix Acrobat PDF Calculation Errors Caused by Text Values and Field Formatting
Product
Adobe Acrobat
Device & OS
not provided
Scenario
A PDF form uses a calculation script to read input fields with valueAsString and write a result to another field.
Observed behavior
The calculation produces a format error for some numeric values.
Before you start

Open the PDF in Acrobat and select Prepare a form. Identify the input fields, the calculated result field, and their exact field names in the form editor.

Solution 1Recommended

Convert input values and check the calculated field

Use this approach when a custom calculation reads text values or reports that a result does not match the field format.

1
Open the calculation script

In Prepare a form, right-click the result field and select Properties. On the Calculate tab, select Custom calculation script and click Edit.

2
Convert and validate inputs

Replace the field names and arithmetic in your script as needed. For example: var s1 = this.getField("Input1").valueAsString.replace(/^\s+|\s+$/g, ""); var s2 = this.getField("Input2").valueAsString.replace(/^\s+|\s+$/g, ""); var n1 = Number(s1); var n2 = Number(s2); event.value = (s1 !== "" && s2 !== "" && isFinite(n1) && isFinite(n2)) ? n1 - n2 : ""; This leaves the result blank if either input is blank or invalid.

3
Remove circular references

In the script editor, check that the result field is not read as one of its own inputs. If Act100uL is the calculated field, do not use its value to calculate Act100uL.

4
Test without result formatting

In the result field's Properties, open the Format tab and set the format category to None. Close Properties, preview the form, and test valid, blank, and invalid inputs.

5
Restore the intended format

After the calculation works, return to Properties > Format and choose the desired numeric format. Test the form again with the values that previously caused the error.

Convert input values and check the calculated field
Check decimal input conventions: The Number() example expects JavaScript-compatible numeric text, such as 1.25. If the form accepts localized values such as 1,25, normalize or validate them before conversion.
Free Microsoft Office alternative

Work with PDF and Office files in WPS Office

WPS Office is a free, lightweight alternative for everyday PDF and Office work. Its familiar interface and format support make it easy to move existing documents into your workflow. Use Adobe Acrobat to troubleshoot Acrobat-specific form scripts.

Open and work with PDF files alongside Office documentsCompatible with Microsoft Word, Excel, and PowerPoint formats, including DOCX, XLSX, and PPTXFree, lightweight tools with a familiar interfaceMove existing Office files into a streamlined workspace
microsoft office alternative - wps office

Frequently Asked Questions

Why can valueAsString cause a calculation problem?

valueAsString returns text. Convert each input with Number() or parseFloat() before arithmetic, and explicitly handle blank or invalid values.

Where can I change the result field's format in Acrobat?

Select Prepare a form, right-click the result field, and choose Properties. On the Format tab, select None while testing, then restore the intended format.

What is a circular calculation in a PDF form?

It occurs when a calculated field depends on its own value, directly or through other fields. Open the result field's Calculate script and remove any dependency on the result field itself.

Why does Number() need a separate blank check?

Number() converts an empty string to zero. Check the trimmed input before conversion if a blank field should leave the result blank instead.