How to Validate PDF Form Totals to Allow Only Specific Values (1 or 5)
Question details
The user needs to restrict a PDF form's calculated total to exactly 1 or 5, prevent any other values (like 0, 2, 3, 4, or >5), and display a validation warning if an incorrect total is generated.

- Product
- Adobe Acrobat / PDF
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form where user selections must result in a strict, mutually exclusive numerical total.
- Observed behavior
- The current form uses independent checkboxes, which allows users to select multiple options and generate invalid total values without triggering a warning.
Ensure your PDF editor supports advanced form field properties, grouped radio buttons, and custom JavaScript for field validation.
Replace Checkboxes with Mutually Exclusive Radio Buttons
The most effective way to prevent multiple selections and invalid totals is to group choices using radio buttons instead of independent checkboxes.
When choices are mutually exclusive (e.g., selecting only the 1-value or the 5-value option), radio buttons are functionally superior to checkboxes. Checkboxes are independent, allowing multiple selections, whereas radio buttons in the same group only allow one active choice.
By using radio buttons, you avoid complex validation scripts entirely by preventing invalid combinations from the very start.
Open your PDF form editor, locate the independent checkboxes that currently hold the 1 and 5 values, and delete them.
Add a new Radio Button group to your form. Place the first radio button where the 1-value option belongs, and the second where the 5-value option belongs.
Double-click the first radio button to open its Properties. Under the 'Options' tab, set its 'Radio Button Choice' or 'Export Value' to '1'. Do the same for the second button, setting its value to '5'.
In the General Properties of the radio button group, check the 'Required' box. This forces the user to make a selection, eliminating '0' as a possible total.
Create a read-only Text Field. In its 'Calculate' properties, set it to display the value of the selected radio button group.

Apply Custom JavaScript Validation to the Total Field
If your form design absolutely requires checkboxes, you must add a custom validation script to the calculated total field to enforce the 1 or 5 rule.
Design Professional PDF Forms with WPS Office
WPS Office provides comprehensive PDF editing tools, allowing you to easily add interactive form fields, configure radio buttons, and manage field properties without needing complex coding skills.
- 1. Open PDF in WPS Office: Launch WPS Office and open your existing PDF form document.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to access interactive form controls.
- 3. Insert Radio Buttons: Select the 'Radio Button' tool and click on the document area to place your grouped, mutually exclusive options.
- 4. Configure Properties: Double-click the newly inserted form field to open the Properties panel, where you can assign exact export values and mark the field as required.

Frequently Asked Questions
Why should I use radio buttons instead of checkboxes for PDF forms?
Radio buttons are specifically designed for mutually exclusive choices, meaning only one option can be selected at a time within a specific group. Checkboxes operate independently and allow multiple selections, which can lead to invalid totals or conflicting data if not carefully managed with scripts.
How do I make a PDF form field mandatory?
To make a field mandatory, right-click the form field in your PDF editor, select 'Properties', navigate to the 'General' tab, and check the 'Required' box. This ensures the user cannot submit or finalize the form without interacting with that specific field.
Can I show a pop-up warning if a user enters the wrong value in a PDF form?
Yes. In most advanced PDF editors, you can open the field's Properties, go to the 'Validate' tab, and choose to run a custom JavaScript. By utilizing the 'app.alert()' function in your code, you can trigger a customized pop-up warning when a user's input violates your validation rules.




