How to Disable Other PDF Checkboxes When One is Selected
Question details
The user needs to make multiple checkboxes in a PDF form mutually exclusive, so that selecting one automatically disables or alters the state of the others.

- Product
- PDF Editors
- Device & OS
- not provided
- Scenario
- Creating or modifying interactive PDF forms where certain checkbox selections should restrict users from choosing other specific options.
- Observed behavior
- By default, multiple checkboxes can be selected independently; the goal is to implement a script or property that forces dependent checkboxes to become read-only or deselected when a primary checkbox is checked.
Ensure you have access to a professional PDF editor with form creation and JavaScript support, as basic PDF readers cannot edit form field properties or execute custom validation scripts.
Use JavaScript to Control Checkbox Read-Only States
Apply a custom JavaScript action to the checkbox properties so that checking it dynamically alters the read-only state of related fields.
This method uses the 'Mouse Up' trigger in your PDF form editor. By writing a short conditional script, you can instruct the document to lock (make read-only) or unlock other specific checkboxes whenever a user interacts with the current one.
Open your document in a PDF editor that supports form field manipulation. Navigate to the 'Form' or 'Prepare Form' tool to view all interactive fields.
Right-click the primary checkbox that will control the others, and select 'Properties' from the context menu.
Go to the 'Actions' tab. Choose 'Mouse Up' from the Select Trigger dropdown, and 'Run a JavaScript' from the Select Action dropdown. Click 'Add'.
In the JavaScript editor, type a script to check the value. For example: `if(event.target.value !== 'Off') { this.getField('Checkbox2').readonly = true; } else { this.getField('Checkbox2').readonly = false; }`. Replace 'Checkbox2' with the actual name of your target field.
Click 'OK' to save the script. Repeat this process for any other checkboxes in the group, adjusting the target field names in the script so they all update dynamically based on the user's selection.

Create and Manage Interactive PDF Forms with WPS Office
WPS Office features a robust PDF editing suite that allows you to easily insert checkboxes, radio buttons, and text fields into your documents. Create professional, fillable forms without the need for complex formatting.
- 1. Open Your PDF in WPS Office: Launch WPS Office and open your PDF document using the built-in PDF tool.
- 2. Navigate to the Form Tab: Click on the 'Form' tab on the top ribbon to access the interactive field creation tools.
- 3. Insert and Configure Checkboxes: Select the 'Checkbox' or 'Radio Button' icon to draw fields on your page, then double-click them to configure their properties and groupings.

Frequently Asked Questions
Why isn't my JavaScript working when I open the PDF in a web browser?
Many built-in web browser PDF readers (like Chrome or Edge) and basic mobile PDF viewers have limited or no support for Acrobat JavaScript. To ensure form scripts run correctly, users should open the file in a dedicated PDF application like WPS PDF or Adobe Acrobat.
What is the difference between making a checkbox read-only and hiding it?
A read-only checkbox remains visible on the document but prevents the user from clicking or changing its state. A hidden checkbox is completely removed from view. Both states can be controlled dynamically via JavaScript using `readonly = true` or `display = display.hidden`.
Can I deselect other checkboxes instead of making them read-only?
Yes. In your JavaScript, instead of changing the `readonly` property, you can change the field's value. For example, use `this.getField('Checkbox2').value = 'Off';` to automatically uncheck 'Checkbox2' when the primary checkbox is selected.




