How to Use JavaScript in PDF Checkboxes for a None Option
Question details
The user needs to configure a fillable PDF form where selecting a 'None' checkbox clears all other active checkbox choices, and selecting any other choice clears the 'None' option.

- Product
- Adobe Acrobat / PDF Forms
- Device & OS
- not provided
- Scenario
- Creating a customized insurance-claim PDF form where multiple conditions can be selected, but selecting 'None' must automatically act as a mutually exclusive override.
- Observed behavior
- The PDF form requires custom automated behavior because standard checkboxes allow all options to be selected simultaneously, which contradicts the logic of a 'None' option.
Ensure you have a PDF editor that supports form-editing and custom JavaScript execution. Verify the exact field names of your existing checkboxes, as JavaScript field referencing is strictly case-sensitive.
Add Mouse Up JavaScript Actions to Checkboxes
Use a simple JavaScript assigned to the Mouse Up trigger on your checkboxes to instantly evaluate and deselect conflicting fields.
This method involves adding a script to the 'None' checkbox to clear the others, and a reciprocal script to all other checkboxes to clear the 'None' option when they are clicked.
Open your PDF form in editing mode. Right-click the 'None' checkbox and select 'Properties' from the context menu.
Navigate to the 'Actions' tab. Select 'Mouse Up' from the Select Trigger dropdown, choose 'Run a JavaScript' from the Select Action list, and click the 'Add' button.
In the JavaScript Editor, paste the following code: `if (event.target.value != "Off") { this.getField("Roof").value = "Off"; this.getField("Water").value = "Off"; this.getField("Fire").value = "Off"; this.getField("Other").value = "Off"; }` (adjust the field names to match your form exactly) and click OK.
Close the properties window and open the Properties for one of the other checkboxes (e.g., Roof). Go to the Actions tab, add a 'Run a JavaScript' action for the 'Mouse Up' trigger.
Paste the following script into the editor: `if (event.target.value != "Off") { this.getField("None").value = "Off"; }`. Repeat this step for all remaining standard checkboxes (Water, Fire, Other).

Create and Edit Interactive PDF Forms with WPS Office
WPS Office includes a comprehensive PDF editor that allows you to easily design fillable forms, insert interactive checkboxes, and manage form properties without complex technical hurdles.
- 1. Open Your PDF: Launch WPS Office and open your PDF document using the built-in PDF editor.
- 2. Access Form Tools: Navigate to the 'Form' tab in the top navigation ribbon to reveal all interactive form elements.
- 3. Insert Checkboxes: Click the 'Check Box' tool and click anywhere on the document to place your interactive checkbox.
- 4. Edit Properties: Double-click the newly created checkbox to adjust its appearance, name, and export values to suit your document's needs.

Frequently Asked Questions
Why isn't my PDF checkbox JavaScript clearing the other boxes?
The most common issue is mismatched field names. JavaScript is highly case-sensitive, meaning 'roof', 'Roof', and 'Roof ' (with a space) are treated as completely different fields. Verify your checkbox names in the Properties panel and update your script accordingly.
Should I use Radio Buttons instead of Checkboxes for this form?
Radio buttons are naturally mutually exclusive, meaning you can only select one option from a group. If your form requires users to select multiple options (e.g., both Roof and Water) but have 'None' clear everything, you must use Checkboxes with custom JavaScript.
How do I make the other checkboxes read-only when 'None' is selected?
Instead of changing the value to 'Off', modify the field's read-only property in your JavaScript. Use `this.getField("Roof").readonly = true;` when the 'None' option is selected, and set it back to `false` when 'None' is cleared.




