How to Use a Single Checkbox to Select Multiple PDF Form Fields
Question details
The user needs a method to make a single master checkbox automatically check or uncheck multiple associated checkboxes in a PDF form, while still allowing users to manually toggle the individual checkboxes.

- Product
- PDF Editor
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form containing grouped options, such as selecting an entire region (e.g., EU) to automatically fill in associated countries.
- Observed behavior
- The user wants the master checkbox to control multiple dependent checkboxes dynamically using an automated script or action.
Ensure your PDF form is opened in a PDF editor that supports form field editing and JavaScript actions. Verify the exact field names of your individual checkboxes, as they must perfectly match the names used in your script.
Use Mouse Up JavaScript on the Master Checkbox
Apply a custom JavaScript snippet to the master checkbox to loop through and toggle the child checkboxes whenever the master box is clicked.
By utilizing a Mouse Up event script, you can dynamically control an array of child fields based on the state of the parent checkbox. This method preserves the user's ability to check or uncheck individual items manually.
Open your PDF document in your PDF editor and enter the Form Preparation or Form Editing mode.
Right-click on the master checkbox (for example, the 'EU' checkbox) and select 'Properties' from the context menu.
Navigate to the 'Actions' tab. Select 'Mouse Up' as the Select Trigger, choose 'Run a JavaScript' from the Select Action dropdown, and click 'Add'.
In the JavaScript Editor window, paste the following code: var euCountries = ["Spain", "Portugal", "Italy", "France", "Germany", "Greece"]; for (var i in euCountries) { this.getField(euCountries[i]).checkThisBox(0, event.target.value != "Off"); }
Click 'OK' to close the editor, then close the Properties dialog. Exit form editing mode and click the master checkbox to verify that all specified country fields update accordingly.
Create and Manage Interactive PDF Forms with WPS Office
WPS Office offers robust PDF form editing features, allowing you to add text fields, checkboxes, and interactive elements seamlessly. Manage your document workflows easily with high compatibility across standard PDF formats.
- 1. Open your PDF: Download and launch WPS Office, then open the PDF document you want to edit.
- 2. Navigate to Form Tools: Click on the 'Form' tab located on the top ribbon to access the interactive editing tools.
- 3. Add or Edit Checkboxes: Use the 'Check Box' tool to place new selection boxes or click existing ones to adjust their properties.
- 4. Save Your Form: Configure your field names and settings, then save the document to preserve your interactive PDF form.

Frequently Asked Questions
Why is the JavaScript checkbox script not working?
This is almost always caused by a mismatch between the field names listed in the JavaScript array and the actual field names of the checkboxes in the PDF form. Double-check for typos, extra spaces, and ensure the casing matches exactly.
Can I group PDF checkboxes without using JavaScript?
Yes, you can give multiple checkboxes the exact same field name but assign them different export values. However, doing this makes them behave like radio buttons (only one can be selected at a time), which prevents users from selecting multiple individual options independently.
Does this script prevent users from checking individual countries manually?
No, the script only triggers when the master 'EU' checkbox is clicked. The user retains the ability to manually check or uncheck individual country checkboxes at any time.




