PDF Editing Issues

How to Enable and Disable PDF Radio Buttons with a Checkbox

Nimra MalikNimra Malik Nov 2, 2026 869 views

Question details

The user wants to control the read-only state of specific radio buttons in a PDF form using a checkbox.

How to Enable and Disable PDF Radio Buttons with 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.
Before you start

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.

Solution 1Recommended

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.

1
Open Field Properties

Right-click the checkbox field in your PDF form editor and select 'Properties' from the context menu.

2
Navigate to the Actions Tab

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.

3
Add the JavaScript Code

Click the 'Add' button and paste the following code: this.getField("X8").readonly = (event.target.value != "Off");

4
Apply to Additional Fields

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");

5
Save and Test

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.

Use a JavaScript Action on the Checkbox Event
Verify Field Names: Make sure to replace 'X8' and 'X9' in the script with the exact names of the radio button fields in your specific document.
Powerful PDF Form Editor

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. 1. Open WPS Office: Launch WPS Office and open your PDF document containing the forms.
  2. 2. Access PDF Tools: Navigate to the 'Form' or 'Edit' tab to interact with your PDF fields.
  3. 3. Manage Form Fields: Use the provided tools to fill out checkboxes, radio buttons, and text fields effortlessly.
Easily fill and manage interactive PDF forms and fields.Highly compatible with standard PDF formats and form structures.Edit PDF text, images, and pages with an intuitive interface.Lightweight alternative to heavy and expensive PDF editors.
microsoft office alternative - wps office

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.