Use Acrobat JavaScript to Update PDF Checkboxes from a Dropdown
Question details
Connect a marital-status dropdown to three PDF form checkboxes and optionally update the dropdown when a checkbox is selected.

- Product
- Adobe Acrobat Pro PDF forms
- Device & OS
- not provided
- Scenario
- A PDF form has a marital-status dropdown and separate Married, Single, and Divorced checkboxes.
- Observed behavior
- Selecting a dropdown value should check the matching box and clear the others; Widowed and Widow should select Single.
Open the form in Adobe Acrobat Pro and use All tools > Prepare a form to check the exact field names and confirm that the three controls are checkboxes, not radio buttons. The scripts below assume one widget per checkbox and dropdown values that match the labels shown.
Update the checkboxes from the dropdown
Use a dropdown validation script to select the matching checkbox and clear the others.
In All tools > Prepare a form, right-click the marital-status dropdown, choose Properties, and open the Validate tab.
Select Run custom validation script and click Edit. Paste the following script, replacing the field names with the exact names in your form: var v = event.value; this.getField("Married").checkThisBox(0, v === "Married"); this.getField("Single").checkThisBox(0, v === "Single" || v === "Widowed" || v === "Widow"); this.getField("Divorced").checkThisBox(0, v === "Divorced");
Close the properties dialog and use Preview to select each dropdown option. Confirm that Married, Single, and Divorced select their respective boxes, and that Widowed and Widow select Single.
If a selection does not work, open the JavaScript console with Ctrl+J on Windows and check for errors. Verify the field names, dropdown export values, and checkbox type in Prepare a form.

Optionally update the dropdown from the checkboxes
Add a Mouse Up action to each checkbox if users should also be able to choose a status by clicking a box.
Work with PDF forms and Office files in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and Office documents. Use it to view and fill PDF forms and continue working with existing Office files; creating or troubleshooting Acrobat form JavaScript requires a compatible PDF form editor.

Frequently Asked Questions
Where should I put the dropdown JavaScript in Acrobat?
In Prepare a form, open the dropdown's Properties > Validate, select Run custom validation script, and click Edit.
Why does Widowed not select the Single checkbox?
Check the dropdown option's stored export value in Properties > Options. The script must compare event.value with that exact value, not necessarily the displayed label.
What does the zero in checkThisBox(0, true) mean?
It identifies the first widget in the checkbox field. The examples assume each named checkbox has one widget; a field with multiple widgets may require a different index.
Can I use the same script for radio buttons?
First confirm the control type in Prepare a form. Radio-button groups have different field and export-value arrangements, so their selection logic may need to be adapted rather than copied unchanged.
Will every PDF viewer run the form JavaScript?
No. JavaScript support varies by viewer and settings. Test the completed form in the PDF applications your recipients will use, including Acrobat or Acrobat Reader.




