PDF Editing Issues

How to Use a Single Checkbox to Select Multiple PDF Form Fields

Jason MillerJason Miller Nov 5, 2026 870 views

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.

How to Select Multiple Country Fields with One PDF Checkbox
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.
Before you start

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.

Solution 1Recommended

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.

1
Open Form Editing Mode

Open your PDF document in your PDF editor and enter the Form Preparation or Form Editing mode.

2
Access Checkbox Properties

Right-click on the master checkbox (for example, the 'EU' checkbox) and select 'Properties' from the context menu.

3
Add a JavaScript Action

Navigate to the 'Actions' tab. Select 'Mouse Up' as the Select Trigger, choose 'Run a JavaScript' from the Select Action dropdown, and click 'Add'.

4
Insert the Script

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"); }

5
Save and Test

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.

Exact Name Matching: Ensure that the names inside the bracketed array (e.g., "Spain") exactly match the Field Name properties of the individual checkboxes in your PDF. JavaScript is case-sensitive.
Edit PDF Forms Easily

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. 1. Open your PDF: Download and launch WPS Office, then open the PDF document you want to edit.
  2. 2. Navigate to Form Tools: Click on the 'Form' tab located on the top ribbon to access the interactive editing tools.
  3. 3. Add or Edit Checkboxes: Use the 'Check Box' tool to place new selection boxes or click existing ones to adjust their properties.
  4. 4. Save Your Form: Configure your field names and settings, then save the document to preserve your interactive PDF form.
Easily add, edit, and manage PDF checkboxes and interactive form fieldsHigh compatibility with standard PDF formats including Adobe Acrobat formsLightweight, user-friendly interface for seamless PDF editingComprehensive built-in tools for everyday document and form processing
microsoft office alternative - wps office

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.