How to Make Acrobat Form Fields Read-Only Based on a Yes/No Choice
Question details
The user needs to dynamically change the read-only status of multiple Acrobat PDF form fields based on a Yes or No selection from a dropdown menu.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Designing an interactive PDF form where specific text fields become locked (read-only) or editable depending on the user's choice in a dropdown field.
- Observed behavior
- The target text fields (e.g., Text10 to Text30) must toggle their read-only property to true when 'Yes' is selected, and false when 'No' is selected, without locking the dropdown itself.
Verify the exact names of the target fields you want to lock or unlock, and ensure you are working in 'Prepare Form' mode with permission to edit the PDF's JavaScript properties.
Apply Custom JavaScript to the Dropdown Field
Use a custom JavaScript script in the dropdown field's Validate or Commit event to loop through the target fields and toggle their read-only status.
By attaching a script to the dropdown field, you can execute a loop that dynamically updates the state of other specified fields whenever the user changes the dropdown value.
Open your PDF document in Adobe Acrobat and select the 'Prepare Form' tool from the right-hand pane to view all interactive fields.
Right-click the target dropdown field (for example, 'Retire_Material') and click on 'Properties' from the context menu.
Navigate to the 'Validate' tab (or the 'Actions' tab and select 'Commit'). Choose the option to run a custom JavaScript and click the 'Edit' or 'Add' button.
Input a script that loops through your target text fields (e.g., Text10 through Text30). Use an 'if' statement to check the event value: set 'getField("FieldName").readonly = true;' if the value is 'Yes', and 'false' if it is 'No'.
Click 'OK' to save the script, close the Properties window, and click the 'Preview' button at the top right to test selecting 'Yes' and 'No' in the dropdown.

Easily Fill and Manage PDF Forms with WPS Office
While advanced JavaScript configuration requires specific editing tools, WPS Office provides a highly accessible, lightweight solution for filling, signing, and managing standard interactive PDF forms on a daily basis.
- 1. Install WPS Office: Download and install the free WPS Office suite on your computer or mobile device.
- 2. Open Your PDF Form: Launch WPS Office, click 'Open', and select the interactive PDF form you need to fill out.
- 3. Fill in the Fields: Click directly into the highlighted form fields, dropdowns, or checkboxes to enter your data and make selections.
- 4. Save and Export: Once completed, click the 'Save' icon or go to 'Menu' > 'Export to PDF' to save your filled document securely.

Frequently Asked Questions
Why is my dropdown menu locking itself after selecting 'Yes'?
This happens if your script's loop mistakenly includes the dropdown field's name, or if you apply a blanket 'readOnly = true' command without excluding the dropdown. Ensure your code specifically addresses only the target text fields (e.g., Text10 to Text30).
Should I place the script in the Validate or Commit event?
Placing the script in the 'Validate' event triggers the change immediately as the user selects the option, providing instant visual feedback. The 'Commit' event (often under Actions > On Blur) triggers only when the user clicks away from the dropdown. Validate is usually preferred for immediate toggling.
Can I test the read-only JavaScript without saving the PDF document?
Yes, you can click the 'Preview' button in the upper right corner of the 'Prepare Form' tool interface. This lets you simulate the user experience and verify that the text fields lock and unlock correctly based on your dropdown choice before you save the file.




