PDF Editing Issues

Set PDF Radio Buttons and Checkboxes with Adobe Acrobat JavaScript

Steven ParkerSteven Parker Nov 19, 2026 868 views

Question details

The user wants one PDF form checkbox to set multiple radio buttons and another checkbox to specified values.

Set PDF Radio Buttons and Checkboxes with Adobe Acrobat JavaScript
Product
Adobe Acrobat PDF forms
Device & OS
not provided
Scenario
Selecting a controlling checkbox should automatically populate other fields in a PDF form.
Observed behavior
The desired result is for the target radio groups and checkbox to reflect the specified Yes or No selections.
Before you start

Open the PDF in Adobe Acrobat and use Prepare a Form to check the exact field names and export values. Decide whether users may override the automatic selections and what should happen when the controlling checkbox is cleared.

Solution 1Recommended

Add a Mouse Up JavaScript action to the controlling checkbox

Use a checkbox action to set the target fields when the controlling checkbox is selected.

PDF form scripts assign export values, which may differ from the labels visible on the form. The example leaves the target fields unchanged when the controlling checkbox is cleared.

1
Check the field properties

In Acrobat, open Prepare a Form and double-click each field. On the General tab, note each field name; on the Options tab, check the checkbox export value and each radio button choice value.

2
Open the checkbox action

Double-click the controlling checkbox, open the Actions tab, select Mouse Up as the trigger and Run a JavaScript as the action, then click Add.

3
Enter the script

In the JavaScript editor, enter the following example and replace the field names and values with those from your form: if (event.target.value !== "Off") { this.getField("RadioGroup1").value = "Yes"; this.getField("RadioGroup2").value = "No"; this.getField("OtherCheckbox").value = "Yes"; } Use the exact export value for each desired selection. For an unchecked target checkbox, assign "Off" instead.

4
Save and test the form

Click OK to save the script, close the field properties, and use Preview in Prepare a Form. Select and clear the controlling checkbox, then check the target fields and any manual overrides.

Add a Mouse Up JavaScript action to the controlling checkbox
Choose a clearing behavior: This example does not reset or reverse target values when the controlling checkbox is cleared. Add an else branch with the intended values if clearing it should change those fields. PDF JavaScript behavior also depends on the viewer and its security settings.
Free Microsoft Office alternative

Work with PDFs and Office files in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and Office documents. Its format compatibility helps you move existing files into your workflow, although it does not fix Acrobat JavaScript actions.

Open and review PDF forms alongside other documents.Compatible with Microsoft Office formats including DOCX, XLSX, and PPTX.Familiar interface for an easier transition from Microsoft Office.Free, lightweight office suite for everyday document work.
microsoft office alternative - wps office

Frequently Asked Questions

How do I find a radio button's value for the script?

In Acrobat's Prepare a Form tool, double-click the radio button and check its choice value on the Options tab. Assign that exact value to the radio group field in the script.

How do I uncheck the other checkbox with JavaScript?

Assign the target checkbox field the value "Off", for example: this.getField("OtherCheckbox").value = "Off". Replace the field name with the one shown on its General tab.

Can users change the automatically selected fields?

Yes, if the target fields remain editable. A Mouse Up action runs when the controlling checkbox is clicked, so a later click on it may apply the scripted selections again.

Why doesn't the script run in my PDF viewer?

Some PDF viewers do not support Acrobat form JavaScript or may restrict it through security settings. Test the saved form in Adobe Acrobat or Acrobat Reader with JavaScript permitted.