How to Link PDF Checkboxes to a List Box with Adobe Acrobat JavaScript
Question details
The user needs to automatically check a specific combination of checkboxes when a specific value is selected from a list box in a PDF form.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form where selecting an option from a list box drives the state of multiple checkboxes dynamically.
- Observed behavior
- Selecting a value in the list box should trigger a script that sets predefined checkboxes to their export values (checked) or to 'Off' (unchecked).
Ensure you have access to a PDF editor that supports JavaScript scripting, such as Adobe Acrobat Pro, and verify the exact field names and export values of your list box and checkboxes before writing the code.
Use a Validate or Keystroke Script in Acrobat
Apply a custom JavaScript snippet to the list box's validation or keystroke properties to control the corresponding checkboxes based on the selected value.
By reading the export value of the list box whenever it changes, you can use a JavaScript switch statement to set the target checkboxes to either their specific export value (to check them) or 'Off' (to uncheck them).
Open your PDF document in Adobe Acrobat, navigate to the Tools menu, and select 'Prepare Form' to enable form editing.
Add a List Box field (e.g., 'MyListBox') and multiple Checkbox fields (e.g., 'Check1', 'Check2') to the page. Assign specific, consistent export values to each checkbox in their respective Options properties.
Right-click the list box field and select 'Properties'. Navigate to the 'Validate' tab (or 'Keystroke' tab if you prefer triggering on keystrokes).
Select 'Run custom validation script' and click 'Edit'. Enter a script that reads 'event.value'. Use a switch statement to determine the selection, and apply 'this.getField("CheckName").value = "ExportValue";' to check a box, or 'this.getField("CheckName").value = "Off";' to uncheck it.
Click 'Close' to exit the properties dialog. Exit 'Prepare Form' mode and test every option in your list box to ensure the correct combinations of checkboxes are applied.

Easily Fill and Manage PDF Forms with WPS PDF
While creating custom JavaScript triggers requires specialized authoring software, filling and interacting with complex PDF forms is simple with WPS Office. WPS PDF provides a comprehensive toolkit for managing interactive PDFs smoothly.
- 1. Install WPS Office: Download and install WPS Office Free on your Windows, Mac, or mobile device.
- 2. Open Your PDF: Launch the WPS PDF tool and open your interactive PDF document containing the list boxes and checkboxes.
- 3. Interact with Form Fields: Click directly on the list boxes to make selections, and the form will operate smoothly. Fill out any additional fields required.
- 4. Save Your Document: Go to the 'Menu' and click 'Save' or 'Save As' to preserve your filled form data securely.

Frequently Asked Questions
Why aren't my checkboxes updating when I change the list box value?
This usually happens if the JavaScript is placed in the wrong trigger event (such as 'Mouse Up' instead of 'Validate' or 'Keystroke'), or if the field names referenced in your code do not perfectly match the actual field names in your PDF properties.
How do I uncheck a checkbox using JavaScript in Acrobat?
To uncheck a checkbox via JavaScript, you must set its value to "Off". For example, use the code: this.getField("CheckboxName").value = "Off";.
Will this JavaScript form logic work in any PDF viewer?
No. Complex JavaScript form calculations and triggers are generally only supported by robust PDF applications like Adobe Acrobat or advanced desktop PDF editors. Many web browsers and basic mobile viewers will disable or ignore these custom scripts.




