Disable PDF Form Fields Based on a Dropdown Selection in Adobe Acrobat
Question details
Make groups of PDF form fields gray and read-only according to a dropdown selection.

- Product
- Adobe Acrobat Pro
- Device & OS
- not provided
- Scenario
- A PDF form contains a dropdown that determines which groups of fields users can edit.
- Observed behavior
- The selected option should control each relevant field's background color and read-only state while keeping its content visible.
Open the form in Adobe Acrobat Pro and use Prepare a form to check the exact dropdown option values and field names. The script must match those names and values, including any export values assigned to dropdown options.
Use a dropdown validation script to control field groups
Apply a gray fill and read-only setting to fields when the dropdown value matches a specified option.
The example disables fields 13a–13e for Option1 or Option2 and fields 14a–14e for Option3. Replace the example field names and option values with those in your form.
The script runs when the dropdown value is validated. The default field appearance should also be set appropriately for the form's initial selection.
In Acrobat Pro, open the PDF, select All tools > Prepare a form, and double-click the dropdown field.
On the Options tab, select Commit selected value immediately so validation runs when the user chooses an option.
On the Validate tab, select Run custom validation script and click Edit. Enter: var disable13 = (event.value == "Option1" || event.value == "Option2"); var disable14 = (event.value == "Option3"); var fields13 = ["Field13a", "Field13b", "Field13c", "Field13d", "Field13e"]; var fields14 = ["Field14a", "Field14b", "Field14c", "Field14d", "Field14e"]; function setGroup(names, disable) { for (var i = 0; i < names.length; i++) { var f = this.getField(names[i]); if (f) { f.fillColor = disable ? color.ltGray : color.white; f.readonly = disable; } } } setGroup.call(this, fields13, disable13); setGroup.call(this, fields14, disable14);
Close the properties dialog, save the PDF, and use Preview in Prepare a form to select each dropdown option. Confirm that the intended fields turn gray and cannot be edited, then become white and editable for other selections.

Work with PDF and Office files in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with PDF and Office documents. Its format compatibility helps you move between common files, although it does not fix Acrobat-specific form JavaScript or guarantee that every PDF viewer will run it.

Frequently Asked Questions
Will a read-only field still be visible?
Yes. Setting a field's readonly property to true prevents editing without hiding the field or its content.
Why doesn't the script recognize my dropdown option?
In Prepare a form, open the dropdown's Properties > Options and check its option and export values. Update the comparisons with the value the form actually uses.
How can I make the fields respond as soon as an option is selected?
Open the dropdown's Properties > Options and select Commit selected value immediately. Then test each choice in Preview.
Will this work in every PDF viewer?
No. The viewer must support the Acrobat form JavaScript used by the dropdown. Test the saved PDF in each viewer your audience uses.




