Set PDF Radio Buttons and Checkboxes with Adobe Acrobat JavaScript
Question details
The user wants one PDF form checkbox to set multiple radio buttons and another checkbox to specified values.

- 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.
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.
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.
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.
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.
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.
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.

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.

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.




