PDF Editing Issues

Create Automatic Pass or Fail Results in an Adobe Acrobat PDF Form

Ayan MasoodAyan Masood Nov 19, 2026 869 views

Question details

The user needs an inspection PDF form to display an automatic pass or fail result based on a numeric range and a checkbox.

Create Automatic Pass or Fail Results in an Adobe Acrobat PDF Form
Product
Adobe Acrobat
Device & OS
not provided
Scenario
An inspection form collects a measured value and a yes-or-no condition, then calculates the result.
Observed behavior
The desired result is a read-only field that updates to Pass or Fail when the form inputs change.
Before you start

Open the PDF in an Acrobat edition that supports creating and editing form fields, such as Acrobat Pro. Decide on the acceptable range and whether the measurement, checkbox, or both must pass.

Solution 1Recommended

Calculate the result with Acrobat form fields and JavaScript

Use a custom calculation when the result must update automatically as the inspector changes a measurement or checkbox.

The example below returns Pass only when the measurement is between 10 and 20 inclusive and the checkbox is selected. Change the limits and logic to match your inspection rules. It leaves the result blank if the measurement is empty or invalid.

1
Create the input fields

Open All tools > Prepare a form. Add a text field named Measurement for the numeric input and a checkbox named InspectionCheck for the yes-or-no condition. In the text field properties, use the Format tab to select Number if appropriate.

2
Add a result field

In Prepare a form, add a text field named Result. Open its Properties and select Read Only on the General tab so the calculated result cannot be edited by the form user.

3
Add the calculation

In Result Properties, open the Calculate tab, select Custom calculation script, and click Edit. Paste this script, adjusting the field names and limits if needed: var raw = String(this.getField("Measurement").valueAsString).replace(/^\s+|\s+$/g, ""); var checked = this.getField("InspectionCheck").value !== "Off"; var n = Number(raw); if (raw === "" || !isFinite(n)) { event.value = ""; } else { event.value = (n >= 10 && n <= 20 && checked) ? "Pass" : "Fail"; }

4
Test the form

Close the field properties and use Preview in Prepare a form. Enter values inside and outside the range, select and clear the checkbox, and confirm that Result updates. Save the PDF when the tests pass.

Calculate the result with Acrobat form fields and JavaScript
Check the inspection logic: This example requires both conditions to pass. For a form where either condition is sufficient, change the expression inside the parentheses to ((n >= 10 && n <= 20) || checked). That version still requires a valid measurement before it displays a result.
Free Microsoft Office alternative

Work with inspection documents in WPS Office

WPS Office is a free, lightweight alternative for working with office documents and PDFs in a familiar interface. Open compatible files as you move your document workflow to WPS; use Acrobat to create or maintain the custom calculation script described above.

Open and review PDF inspection formsCompatible with Microsoft Office formats, including DOCX, XLSX, and PPTXFamiliar document, spreadsheet, and presentation tools support an easier transitionFree, lightweight office suite for everyday document work
QA img-9

Frequently Asked Questions

How do I change the passing range?

Open Result Properties > Calculate > Custom calculation script > Edit. Replace 10 and 20 in the comparisons with your lower and upper limits. The operators >= and <= include both endpoints.

How does the script tell whether the checkbox is selected?

The script reads the InspectionCheck field value. An unchecked Acrobat checkbox normally has the value Off; a selected checkbox has its configured export value.

Why is the result blank when I enter a value?

The example leaves Result blank when Measurement is empty or cannot be converted to a number. Check the field name and enter a valid number in the expected format.

Can the form pass based on either the range or the checkbox?

Yes. In the custom calculation script, use ((n >= 10 && n <= 20) || checked) as the pass condition. The example still requires a valid measurement; change the blank-input rule if your form must pass on the checkbox alone.

Why doesn't the calculation run in a PDF viewer?

Some PDF viewers do not support Acrobat form JavaScript or may have it disabled. Test the saved form in Adobe Acrobat or Acrobat Reader with JavaScript enabled, and verify the field names in Prepare a form.