How to Auto-Select Radio Buttons from a Calculated Score in PDF
Question details
The user needs a PDF form to automatically select a specific overall-grade radio button based on the calculated average score derived from other selected radio buttons.

- Product
- PDF Forms
- Device & OS
- not provided
- Scenario
- Creating an interactive, graded PDF form where a final grade radio button updates dynamically based on the average of multiple user inputs.
- Observed behavior
- The form requires dynamic interaction where a background calculation determines the active state of a target radio button group.
Ensure you are using a PDF editor that supports advanced form field creation and JavaScript execution, and define clearly how unanswered or unchecked items should be treated in your calculation.
Use Form JavaScript with a Hidden Calculation Field
Calculate the average score in a hidden text field, then apply custom JavaScript to automatically select the corresponding radio button based on the resulting score.
To accomplish this, you must separate the calculation logic from the visual radio button selection. A hidden text box handles the mathematical average, and a custom script attached to it triggers the radio button change.
Before creating the script, decide how unchecked items will be handled (e.g., counted as zero or ignored), as this heavily affects the average score denominator.
Add the initial radio buttons or checkboxes to your PDF document that users will interact with to provide their individual scores.
Insert a text box field that will be used to calculate the average. In the field's properties panel, set its visibility to 'Hidden' so it does not display on the final form.
In the hidden text field's properties, navigate to the Calculate tab and input the formula or custom script to calculate the average of the user input fields.
Add a custom formatting or validation script to the hidden calculation field. Write JavaScript to evaluate the calculated average (e.g., if average > 80, set the overall-grade radio button group value to 'A').

Output the Score to a Text Box Instead
Display the final calculated grade in a read-only text box instead of using a radio button.
Create and Manage Interactive PDF Forms with WPS Office
Easily design dynamic PDF forms, insert text fields, manage radio buttons, and configure form properties with WPS Office's comprehensive PDF editing suite.
- 1. Open WPS PDF: Launch WPS Office and open your PDF document in the PDF editor module.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to access the interactive field controls.
- 3. Insert Form Elements: Click on 'Radio Button' or 'Text Field' and drag on the document to place your form elements.
- 4. Edit Properties: Double-click the inserted form field to open the Properties panel, where you can define values, actions, and calculations.

Frequently Asked Questions
Why isn't my target radio button updating automatically when the score changes?
Ensure that the calculation order in your PDF form is correct. The hidden text field calculating the average score must be processed before the script that updates the target radio button.
How do I make a calculation text field hidden in a PDF?
Right-click the text field, select Properties, and under the General tab, locate the 'Form Field' or 'Visibility' property. Change it from 'Visible' to 'Hidden'.
Can I group radio buttons so only one final grade is selected?
Yes. To group radio buttons together so they act as a single exclusive choice, assign the exact same 'Name' to all radio buttons in the group, but give each a unique 'Export Value' (e.g., A, B, C).




