Make an Acrobat Dropdown Required or Read-Only with a Checkbox
Question details
Configure an Acrobat checkbox to control whether a dropdown is required or read-only.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- A PDF form should require a dropdown selection when a checkbox is selected and display N/A when it is not selected.
- Observed behavior
- The desired behavior is an editable, required dropdown when the checkbox is checked and a read-only dropdown containing N/A when it is unchecked.
Open the PDF in Adobe Acrobat and select All tools > Prepare a form. Check the checkbox and dropdown field names and confirm that the dropdown has an empty option and an option with the export value N/A.
Add a JavaScript action to the Acrobat checkbox
Use a checkbox action to reset and require the dropdown when checked, or assign N/A and lock it when unchecked.
The example uses CBDrive as the checkbox field name and DDInter as the dropdown field name. Replace them in the script if your form uses different names.
In Prepare a form, open Properties for the checkbox and dropdown. Confirm their names and use the dropdown's Options tab to add an empty option and an N/A option if needed. The N/A option's export value must be N/A.
Open the checkbox Properties, select the Actions tab, and choose Mouse Up as the trigger. Select Run a JavaScript as the action, then click Add.
In the JavaScript Editor, enter the following code and click OK: var cb = this.getField("CBDrive"); var dd = this.getField("DDInter"); if (cb.value !== "Off") { dd.readonly = false; dd.value = ""; dd.required = true; } else { dd.readonly = false; dd.required = false; dd.value = "N/A"; dd.readonly = true; }
Close Properties and use Preview in Prepare a form. Check the box to verify that the dropdown clears and can be edited; uncheck it to verify that it shows N/A and cannot be edited. Save the PDF when the behavior is correct.

Work with PDFs and Office documents in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and migrating Office documents. The Acrobat checkbox script is specific to Acrobat and may not work in other PDF viewers.

Frequently Asked Questions
Why does the script use Off for the checkbox?
Acrobat uses Off as the value of an unchecked checkbox. The condition cb.value !== "Off" detects a checked state without depending on the checkbox's particular checked export value.
Why does the dropdown need an N/A option?
The script assigns N/A when the checkbox is unchecked. In the dropdown's Properties > Options tab, add an option whose export value is N/A so the assigned value matches an available choice.
Will making the dropdown required prevent users from saving the PDF?
Not necessarily. Acrobat generally checks the required property during form submission, rather than preventing a user from saving the file with an empty field.
Will the checkbox action work in every PDF viewer?
No. PDF viewers differ in their support for Acrobat form JavaScript. Test the saved form in the viewer your recipients will use.




