How to Automatically Select a Check Box from a PDF Text Field
Question details
The user wants to configure an interactive PDF form so that entering a specific number or range in a text input automatically checks a corresponding box (e.g., Mild, Moderate, or Severe) and unchecks others.

- Product
- Device & OS
- not provided
- Scenario
- Creating an automated assessment or evaluation PDF form where a numerical score corresponds to a specific categorized checkbox.
- Observed behavior
- Text values and checkboxes operate independently by default; the goal is to link them conditionally so the check boxes automatically update based on the text field's input.
Before writing your script, clearly define how overlapping or specific numeric ranges (e.g., 2-3, 8-9) should be interpreted, and ensure you have a PDF editor that supports JavaScript for form fields.
Add a Custom Calculation Script to the Text Field
Use a custom JavaScript in the text field's properties to read the entered value, evaluate which range it falls into, and automatically trigger the correct checkbox.
By applying a validation or calculation script directly to the text input field, the PDF form can instantly analyze the number typed by the user. If the number falls within the 'Mild' range, the script turns the 'Mild' checkbox on and clears the 'Moderate' and 'Severe' boxes.
You must know the exact field names of your checkboxes to reference them correctly in the code.
Open your PDF document in a professional PDF editor and navigate to the Form or Prepare Form tab to view all interactive fields.
Right-click the text field where users will input their score and select 'Properties' from the context menu.
In the Properties dialog box, go to the 'Calculate' or 'Validate' tab and select the option to run a 'Custom calculation script'.
Click 'Edit' and enter a script that evaluates the field's value. For example, use conditional if/else statements to check the number, then use the 'getField("CheckboxName").value = "Yes"' method to select the correct box while setting the others to "Off".
Save your script, close the properties window, and exit form editing mode. Type a number into the text field and press Enter to confirm the correct checkbox is selected.

Build Smart Interactive PDFs with WPS Office
WPS Office provides powerful PDF editing and form-building capabilities. You can easily insert text fields, checkboxes, and manage form properties to create interactive, automated documents without hassle.
- 1. Open WPS PDF: Launch WPS Office and open your document using the built-in PDF editor.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to view all interactive form creation tools.
- 3. Insert and Configure Fields: Add text fields and checkboxes to your page. Double-click any field to adjust its properties and behavior.
- 4. Save Your Interactive PDF: Once your fields are configured, save the PDF. It is immediately ready to be filled out by other users.

Frequently Asked Questions
Why aren't my checkboxes updating when I type a number?
This usually happens if the text field hasn't committed the value yet. Try pressing Enter or clicking outside the text field. Also, verify that your field names in the script match the actual checkbox names exactly.
Do I need to know JavaScript to automate PDF forms?
Yes, creating conditional logic between different form fields, such as linking text boxes and checkboxes, requires basic JavaScript knowledge to write the custom calculation script.
Can I use radio buttons instead of checkboxes for this?
Absolutely. In fact, radio buttons are often better suited for mutually exclusive options like Mild, Moderate, or Severe, as they automatically uncheck other options in the same group without needing extra script lines to clear them.
Are PDF JavaScripts compatible across all PDF viewers?
Most advanced PDF software like Adobe Acrobat or WPS PDF support standard JavaScript for forms. However, some basic browser-based PDF plugins or simple mobile viewers might not execute these scripts correctly.




