PDF Editing Issues

How to Create a Pass or Fail Field from a Percentage in Adobe Acrobat

Aamir Naveed AkramAamir Naveed Akram Nov 3, 2026 869 views

Question details

The user needs to configure a calculated PDF form field to automatically display 'PASS' or 'FAIL' based on whether a calculated percentage value meets a specific threshold.

How to Create a Pass or Fail Field from a Percentage in Adobe Acrobat
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Creating dynamic PDF forms where completion percentages or test scores dictate a text output indicating a pass or fail result.
Observed behavior
The goal is to evaluate a percentage score (like 95%) against a required threshold field and automatically output a corresponding text string in a designated form field.
Before you start

Verify the exact names of your source form fields (e.g., 'Comp' and 'Required') and check whether the underlying percentage values are formatted as whole numbers (e.g., 95) or decimals (e.g., 0.95) before writing your script.

Solution 1Recommended

Apply a Custom JavaScript Calculation to the Output Field

Use Acrobat's built-in JavaScript calculation feature to compare the actual percentage against the required threshold and output the appropriate text result.

To achieve a text output based on numeric conditions in Adobe Acrobat, you must use a custom calculation script. This script fetches the values of your source fields, converts them to numbers for accurate mathematical comparison, and assigns the string 'PASS' or 'FAIL' to the destination field.

1
Open Prepare Form mode

Open your document in Adobe Acrobat, go to the 'Tools' menu, and select 'Prepare Form' to enter form editing mode.

2
Access field properties

Right-click the destination text field where you want the Pass/Fail result to appear, and select 'Properties' from the context menu.

3
Navigate to the Calculate tab

In the Properties window, click on the 'Calculate' tab. Select the 'Custom calculation script' option, and then click the 'Edit' button.

4
Enter the JavaScript code

Input your comparison script. For example: var actual = Number(this.getField('Comp').valueAsString); var required = Number(this.getField('Required').valueAsString); event.value = actual > required ? 'PASS' : 'FAIL'; Then, click OK and close the properties window to apply the script.

Apply a Custom JavaScript Calculation to the Output Field
Field Value Formatting: Using 'valueAsString' combined with 'Number()' ensures that Acrobat safely reads the field content and correctly interprets it as a mathematical value rather than a text string.
Comprehensive PDF Editor

Manage and Fill Complex PDF Forms Easily with WPS Office

WPS Office offers a powerful, lightweight PDF toolkit that allows you to easily view, fill, interact with, and manage complex PDF forms containing custom calculation scripts without requiring heavy, expensive software.

  1. 1. Download and Install: Download WPS Office for free from the official website and complete the installation process.
  2. 2. Open Your PDF Form: Launch WPS Office, click on 'Open', and select your dynamic PDF form file.
  3. 3. Interact and Fill: Navigate the document to input values into your form fields. WPS PDF will automatically execute underlying standard calculations.
  4. 4. Save and Export: Once the form is filled out and your Pass/Fail fields have updated, click 'Save' or export the document for sharing.
Seamlessly fill and interact with complex PDF forms containing JavaScript calculations.Fully compatible with standard PDF formats including Adobe Acrobat files.Lightweight and fast, offering intuitive tools for adding text fields, signatures, and annotations.Free alternative to expensive PDF editing software with built-in document conversions.
microsoft office alternative - wps office

Frequently Asked Questions

Why is my calculated field showing a blank result instead of PASS or FAIL?

This usually happens if the source fields are empty or if the JavaScript contains a typo. Double-check the exact field names used in your script (e.g., this.getField('Comp')) and ensure they match your actual form field names exactly, as they are case-sensitive.

Do I need to format the Pass/Fail destination field as text or a number?

The target field that displays 'PASS' or 'FAIL' should be formatted as a standard Text field with no special number or percentage formatting applied, since it will be displaying string characters.

How does percentage formatting affect my script comparison?

If your percentage field is formatted to automatically display a percent sign, the underlying programmatic value might be a decimal (e.g., 0.95 representing 95%). You must ensure your script compares the correct format (decimals to decimals or whole numbers to whole numbers) to get accurate Pass/Fail results.