How to Enable and Disable PDF Radio Buttons with a Checkbox
Question details
The user wants to control the read-only state of specific radio buttons in a PDF form using a checkbox.

- Product
- Acrobat
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form where checking or unchecking a box dynamically enables or disables other form fields.
- Observed behavior
- Requires a JavaScript solution to evaluate the checkbox value each time its state changes, rather than setting radio buttons to a permanent read-only state.
Ensure you have your PDF form open in a PDF editor that supports JavaScript form actions, and verify the exact field names for both the checkbox and the radio buttons you intend to control.
Use a JavaScript Action on the Checkbox Event
Assign a custom JavaScript action to the checkbox's Mouse Up event to dynamically change the read-only property of the target radio buttons.
To make the radio buttons respond to the checkbox state dynamically, you must tie a JavaScript evaluation to an interaction event. Using the 'Mouse Up' event ensures the script runs exactly after the user clicks and releases the checkbox.
Right-click the checkbox field in your PDF form editor and select 'Properties' from the context menu.
Go to the 'Actions' tab. Select 'Mouse Up' (or 'Mouse Exit') as the trigger event, and choose 'Run a JavaScript' from the 'Select Action' dropdown.
Click the 'Add' button and paste the following code: this.getField("X8").readonly = (event.target.value != "Off");
If you need to control multiple radio buttons (like 'X9'), add another line using the same logic: this.getField("X9").readonly = (event.target.value != "Off");
Click 'OK' to save the script, close the properties window, and test the checkbox in preview mode to ensure it toggles the read-only state correctly.

Manage and Fill PDF Forms Easily with WPS Office
WPS Office provides a comprehensive PDF toolset that allows you to easily view, fill, and manage interactive PDF forms without needing heavy software.
- 1. Open WPS Office: Launch WPS Office and open your PDF document containing the forms.
- 2. Access PDF Tools: Navigate to the 'Form' or 'Edit' tab to interact with your PDF fields.
- 3. Manage Form Fields: Use the provided tools to fill out checkboxes, radio buttons, and text fields effortlessly.

Frequently Asked Questions
Why is my JavaScript not working in the PDF form?
Ensure that JavaScript is enabled in your PDF viewer's preferences and that the field names used in your script perfectly match the actual field names in the form, as they are case-sensitive.
Can I use 'Mouse Enter' instead of 'Mouse Up' for the checkbox?
It is recommended to use 'Mouse Up' because it triggers after the user has completed the click action, ensuring the checkbox state has fully updated before the script evaluates it.
How do I control multiple radio buttons with one checkbox?
You can add multiple lines of code within the same JavaScript action window. Simply repeat the getField script for each target field name you want to control.




