PDF Editing Issues

How to Display Text Based on a Score Range in an Acrobat PDF Form

Steven ParkerSteven Parker Nov 3, 2026 869 views

Question details

The user needs to calculate a total score from radio-button selections and automatically display a corresponding text category (such as risk levels) in a separate text field.

How to Display Text Based on Score Ranges in an Acrobat PDF Form
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Building an interactive PDF form where a numerical score automatically determines and displays a categorical text outcome based on defined value brackets.
Observed behavior
The form setup requires assigning numeric export values to radio buttons, calculating the total sum in a designated field, and using a custom JavaScript calculation to output specific text depending on the score.
Before you start

Ensure you are using a PDF editor that supports advanced form authoring and custom JavaScript calculations, such as Adobe Acrobat Pro.

Solution 1Recommended

Use Custom Calculation Scripts in Acrobat

By combining the standard Sum function with a custom JavaScript calculation, you can automatically convert numerical scores into specific text categories.

This solution relies on three components: setting explicit export values for your input buttons, summing those values into a hidden or visible score field, and then reading that score field via a custom script to populate the final text field.

1
Set Radio Button Export Values

Right-click each of your radio buttons and go to Properties. Under the Options tab, set the 'Export Value' to the specific numeric value needed for the final score.

2
Calculate the Total Score

Create a new text field named 'RiskLevelScore'. Open its Properties, navigate to the Calculate tab, select 'Value is the sum (+)', and choose the radio buttons you want to include in the calculation.

3
Add a Custom Script to the Target Text Field

Create the final text field where the text category will appear (e.g., 'RiskLevel'). Open its Properties, go to the Calculate tab, select 'Custom calculation script', and click the Edit button.

4
Insert the JavaScript Code

In the JavaScript editor, enter the following code to evaluate the score: var nScore = this.getField("RiskLevelScore").value; if (nScore >= 15) event.value = "High Risk"; else if (nScore >= 3) event.value = "Moderate Risk"; else if (nScore >= 1) event.value = "Low Risk"; else event.value = "No Risk"; Click OK and close the properties panel to save your changes.

Use Custom Calculation Scripts in Acrobat
Test Your Form: Switch to the Preview or Hand tool in Acrobat, select different radio button options, and verify that the RiskLevel text updates automatically based on the newly calculated total.

Easily Create and Manage Interactive PDF Forms with WPS Office

If you need an intuitive, fast, and feature-rich tool for managing PDF documents, WPS Office provides excellent capabilities for creating, filling, and editing interactive PDF forms without the steep learning curve of advanced script editors.

  1. 1. Open your PDF in WPS: Launch WPS Office and open your interactive PDF document using the WPS PDF tool.
  2. 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to view available interactive elements.
  3. 3. Fill or Edit Elements: Interact with radio buttons, checkboxes, and text fields directly. For form editing, use the provided tools to insert new interactive fields.
  4. 4. Save and Export: Once your form is filled or configured, click Save or export it to share with others seamlessly.
Seamlessly view, fill, and interact with PDF forms containing text fields, checkboxes, and radio buttons.Fully compatible with standard PDF formats and forms created in Adobe Acrobat.Lightweight architecture ensures fast loading and smooth performance on any device.Comprehensive PDF toolkit including conversion, merging, extraction, and secure digital signatures.
QA img-9

Frequently Asked Questions

Why is my PDF form calculation script not updating automatically?

This is usually caused by an incorrect calculation order. Acrobat calculates fields in a specific sequence. Go to 'Prepare Form' > 'More' > 'Clear Form', then check the 'Calculation Order' to ensure the 'RiskLevelScore' field calculates before the custom text script evaluates the score.

Can I use this script for other text categories like letter grades?

Yes. You can modify the script variables and range conditions to output any text string. For example, you can adjust the numerical thresholds to output grades (e.g., 'A', 'B', 'C') based on test percentage scores.

Will this JavaScript work on mobile PDF viewers?

Complex custom JavaScript in PDF forms is widely supported on desktop PDF applications like Adobe Acrobat or WPS Office PC versions. However, third-party mobile PDF readers or built-in browser viewers often strip out or ignore JavaScript, meaning the automatic text calculation might not function correctly on mobile devices.