How to Automatically Select Related Checkboxes in a PDF Form
Question details
Configure a primary checkbox to automatically select or clear two or more dependent checkboxes in an interactive PDF form.

- Product
- PDF Form Editor
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form where user selections need to trigger conditional logic for other fields.
- Observed behavior
- The user wants to automate the form filling process by linking multiple checkboxes, avoiding the need for users to manually check every single related box.
Ensure you are using a PDF editor that supports form field properties and custom JavaScript execution, such as Adobe Acrobat Pro. Note down the exact field names of the checkboxes you intend to control.
Use a Custom JavaScript Action on the Controlling Checkbox
By adding a short JavaScript snippet to the 'Mouse Up' event of the primary checkbox, you can instantly change the state of the related checkboxes.
Interactive PDF forms allow you to attach scripts to form fields. Using the 'Mouse Up' trigger ensures the action runs precisely when the user clicks and releases the checkbox.
Open your PDF form in edit mode. Right-click the controlling checkbox (the one the user will click) and select 'Properties'.
In the Properties dialog box, click on the 'Actions' tab at the top.
From the 'Select Trigger' dropdown, choose 'Mouse Up'. From the 'Select Action' dropdown, choose 'Run a JavaScript', then click the 'Add' button.
In the JavaScript Editor window, paste the following code: if (event.target.value != "Off") { this.getField("Button1").value = "Yes"; this.getField("Button2").value = "Yes"; } else { this.getField("Button1").value = "Off"; this.getField("Button2").value = "Off"; }
Replace 'Button1' and 'Button2' with the exact names of your dependent checkboxes, and adjust 'Yes' to match your specific export values. Click 'OK' and close the properties window to test.

Create and Manage Interactive PDF Forms in WPS Office
WPS Office provides a powerful, lightweight PDF toolkit that allows you to easily insert, modify, and fill interactive form fields like checkboxes and text fields without hassle.
- 1. Open your PDF document: Launch WPS Office and open your existing PDF file.
- 2. Access the Form tools: Navigate to the 'Form' tab located in the top ribbon menu.
- 3. Insert Checkboxes: Click on 'Check Box' in the toolbar and draw the fields directly onto your document layout.
- 4. Adjust Properties: Double-click the inserted checkboxes to easily modify their names, visual appearance, and export values.

Frequently Asked Questions
How do I find the exact field name of my checkbox?
Right-click the target checkbox, select 'Properties', and look at the 'Name' field under the General tab. This exact spelling, including capitalization, must be used in your JavaScript.
Why isn't my JavaScript executing when I click the checkbox?
Ensure that JavaScript is enabled in your PDF reader's preferences (Edit > Preferences > JavaScript). Also, verify that the script is assigned to the 'Mouse Up' trigger rather than 'Mouse Down' to ensure reliable execution across different PDF viewers.
Can I link multiple checkboxes to behave identically without using JavaScript?
Yes. If you simply want two or more checkboxes to check and uncheck simultaneously without conditional logic, you can give them the exact same 'Name' and 'Export Value' in their Properties menu. They will automatically mirror each other.




