PDF Editing Issues

How to Create Dependent Sub-Radio Buttons in Acrobat PDF Forms

Natalie TaylorNatalie Taylor Nov 5, 2026 868 views

Question details

The user wants to set up sub-radio buttons in a PDF form that only become active when a specific main radio button is selected.

How to Create Dependent Sub-Radio Buttons in a PDF Form
Product
Adobe Acrobat PDF
Device & OS
not provided
Scenario
Designing an interactive PDF form with conditional logic for radio buttons.
Observed behavior
The user needs to configure a subgroup of radio buttons to dynamically switch between an enabled state and a disabled (grayed out) state based on the main group's selection.
Before you start

Ensure you have access to form editing tools in your PDF editor and a basic understanding of adding JavaScript code to form fields.

Solution 1Recommended

Use a Custom Calculation Script in a Hidden Text Field

This method relies on creating a hidden text field to run a background calculation script that continuously evaluates the main radio button's value, enabling or disabling the subgroup accordingly.

By utilizing the calculation event of a hidden text field, the script triggers automatically whenever the user interacts with any field in the form. This is highly reliable for managing complex conditional formatting in interactive PDF forms.

1
Create the Main and Sub Radio Buttons

Add your primary radio button group and name it "MainGroup". Assign export values to its options, such as "A", "B", and "C". Then, create your dependent radio button group and name it "SubGroup".

2
Add a Hidden Text Field

Insert a standard text field anywhere onto your PDF form. Right-click the field and open its Properties. Navigate to the General tab, and under Form Field properties, set it to 'Hidden'.

3
Configure the Calculation Script

In the hidden text field's properties window, navigate to the Calculate tab. Select the 'Custom calculation script' radio button and click the Edit button.

4
Insert the JavaScript Code

Paste the following script into the editor: `if (this.getField("MainGroup").valueAsString == "B") { this.getField("SubGroup").readonly = false; } else { this.getField("SubGroup").readonly = true; this.getField("SubGroup").value = "Off"; }`. Click OK to save.

5
Test the Form Logic

Exit the form editing mode. Click on option 'B' in the main radio button group. The sub-radio buttons will become interactive. Clicking 'A' or 'C' will disable the sub-group and clear any existing selections.

Use a Custom Calculation Script in a Hidden Text Field
Field Name Consistency: Ensure the field names specified in the JavaScript snippet exactly match the actual names of the radio button groups you created in the form. JavaScript is case-sensitive.
Free Microsoft Office alternative

Create and Manage Documents Seamlessly with WPS Office

While advanced JavaScript calculations for dynamic fields are specific to Adobe Acrobat, WPS Office offers a highly capable, free alternative to create, edit, and fill standard PDF forms, alongside powerful Word, Excel, and PowerPoint tools.

Fully compatible with Microsoft Office formats (DOCX, XLSX, PPTX) and standard PDF forms.Easily view, edit, and interact with PDF form fields, text boxes, and checkboxes.Lightweight architecture ensuring fast loading times and smooth performance.Familiar user interface requiring zero learning curve for new users.
microsoft office alternative - wps office

Frequently Asked Questions

Why aren't my sub-radio buttons graying out as expected?

This usually occurs due to a typo in the JavaScript code. Verify that the hidden text field contains the exact names of your radio button groups. Because JavaScript is case-sensitive, referencing "maingroup" will fail if the actual field is named "MainGroup".

Can I apply this same script to checkboxes instead of radio buttons?

Yes. You can adapt the JavaScript to check the export value of a specific checkbox instead of a radio group. Simply change the target field name and expected value in the script, and set the readonly property of the dependent fields accordingly.

Do I have to use a hidden text field for this calculation?

While it is possible to place scripts in other triggers, like the 'Mouse Up' action on the main radio button itself, using a hidden text field's calculation event ensures the dependent fields' state updates dynamically and consistently whenever any related form value changes.

What is the purpose of the 'value = "Off"' line in the script?

The `value = "Off"` command ensures that the sub-radio buttons are unchecked when the main condition is no longer met. This prevents contradictory or invalid data from being submitted if the user changes their primary selection later.