Other PDF Issues

How to Check Multiple PDF Checkboxes with One Button Using JavaScript

John WilsonJohn Wilson Nov 3, 2026 869 views

Question details

The user needs to configure a single button in a PDF form to sequentially check three checkboxes one by one with each click, while also triggering a radio button when the first checkbox is selected.

How to Check Multiple PDF Checkboxes with One Button Using JavaScript
Product
PDF
Device & OS
not provided
Scenario
Developing an interactive PDF form that requires automated, sequential field selections triggered by user clicks.
Observed behavior
The user wants to implement a specific sequence where each click of a push button selects the next checkbox in a series, and the first click simultaneously activates an associated radio button.
Before you start

Ensure your PDF editing software supports JavaScript execution and form field editing. Note down the exact field names and export values for your checkboxes, radio button, and the push button before writing the script.

Solution 1Recommended

Use a Mouse Up JavaScript on the Push Button

This solution involves writing a custom JavaScript attached to the button's Mouse Up event to track the number of clicks and update the states of the target checkboxes and radio button accordingly.

To achieve a sequential selection in a PDF form, you must maintain a counter that remembers how many times the button has been clicked. Based on this counter, the script assigns the 'Export Value' to the corresponding checkbox to mark it as checked.

1
Open Form Editing Mode

Open your PDF document in a compatible PDF editor. Access the form editing tools to make the form fields selectable and editable.

2
Access Button Properties

Double-click the push button that you want to use as the trigger. This will open the Button Properties dialog box.

3
Add a JavaScript Action

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

4
Write the State-Tracking Script

In the JavaScript editor, initialize a counter variable if it doesn't exist (e.g., check if typeof clickStep == 'undefined'). Increment this counter with each click.

5
Define the Sequential Logic

Use an if-else statement or switch case based on the counter. On step 1, set the first checkbox and the radio button to their respective export values (e.g., this.getField('CheckBox1').value = 'Yes'). On step 2, set the second checkbox, and on step 3, set the third checkbox.

Use a Mouse Up JavaScript on the Push Button
Resetting the Sequence: You may want to add logic to reset your click counter back to zero and clear all fields after the third checkbox is selected, ensuring the sequence can be repeated if necessary.
Advanced PDF Editing

Create and Edit Interactive PDF Forms with WPS Office

WPS Office provides comprehensive PDF editing tools that allow you to easily insert buttons, checkboxes, radio buttons, and text fields into your documents while ensuring seamless compatibility with standard PDF viewers.

  1. 1. Open your PDF: Launch WPS Office and open your existing PDF document or create a new one.
  2. 2. Navigate to the Form tab: Click on the 'Form' tab on the top ribbon to access all interactive form controls.
  3. 3. Insert Form Controls: Select 'Push Button', 'Check Box', or 'Radio Button' and click on the page to place them.
  4. 4. Edit Properties: Double-click any inserted field to adjust its name, appearance, and export values.
  5. 5. Save the Document: Save your PDF to preserve the interactive form fields for your users.
Easily add and configure interactive PDF form fieldsFully compatible with standard Adobe PDF formatsIntuitive interface for editing checkboxes and radio buttonsLightweight, fast, and feature-rich PDF processor
QA img-9

Frequently Asked Questions

Why isn't my JavaScript executing when I click the button?

Ensure that JavaScript is enabled in your PDF viewer's security preferences. Additionally, verify that your code is assigned to the 'Mouse Up' trigger rather than 'Mouse Down', as 'Mouse Up' is the standard behavior for triggering button actions in PDFs.

How do I find the correct export value for a PDF checkbox?

Open the Checkbox Properties in your PDF editor, navigate to the 'Options' tab, and look for the 'Export Value' field. By default, this is often set to 'Yes'. Your JavaScript must use this exact string to check the box.

Can I group radio buttons so only one can be selected?

Yes. To group radio buttons together, give them the exact same field name but assign a different 'Export Value' to each. This ensures they behave as a mutually exclusive group.

How do I uncheck a checkbox using JavaScript?

To uncheck a checkbox via JavaScript, set its value to 'Off'. For example: this.getField('YourCheckboxName').value = 'Off';