How to Make a PDF Form Field Fillable Only After Another is Completed
Question details
The user wants to configure a PDF form so that a specific field remains unfillable or invisible until the user completes a preceding field.

- Product
- Adobe Acrobat / PDF Editor
- Device & OS
- not provided
- Scenario
- Creating dynamic and interactive PDF forms that require users to enter information in a specific sequence.
- Observed behavior
- Currently, all form fields are active and visible at once, but the goal is to enforce sequential data entry by locking or hiding dependent fields using JavaScript.
Ensure you have a PDF editor that supports form field properties and JavaScript validation. Take note of the exact internal names of both the trigger field (e.g., Field1) and the dependent field (e.g., Field2).
Use JavaScript to Make the Dependent Field Read-Only
Add a custom validation script to the first field that automatically toggles the read-only status of the second field based on whether the first field contains data.
By applying a validation script to the trigger field, the script will run every time the user enters or changes data in that field. It is crucial to manually set the initial state of the dependent field to Read-Only so the form is correct upon opening.
Right-click the first form field (the trigger field) and select 'Properties' from the context menu.
Navigate to the 'Validate' tab. Select the option for 'Run custom validation script' and click the 'Edit' button.
Type the following script to control the second field's read-only state: this.getField('field2').readonly = event.value == '' ? true : false;
Before distributing the document, right-click the second field, go to Properties, and manually check the 'Read-Only' box under the General tab.

Use JavaScript to Hide the Dependent Field Completely
Instead of making the second field read-only, you can keep it entirely invisible until the user populates the first field.
Edit and Manage PDF Forms Easily with WPS Office
WPS Office provides a comprehensive PDF editor that allows you to create, edit, fill, and manage PDF forms effortlessly. Whether you are filling out complex applications or designing your own interactive documents, WPS PDF handles it perfectly.
- 1. Open your PDF form: Launch WPS Office and open your PDF document using the WPS PDF tool.
- 2. Access form features: Navigate to the 'Form' tab on the top ribbon to view all interactive form field tools.
- 3. Edit and fill fields: Click on text fields, checkboxes, or radio buttons to fill in your data seamlessly.
- 4. Save and share: Once completed, click 'Save' to preserve your form data and securely share it with others.

Frequently Asked Questions
Why is the second field not updating immediately after I type in the first field?
Validation scripts in PDF forms are triggered when the field data is committed. You must press 'Enter' or click outside the first field to trigger the script and update the second field.
Can I apply this conditional JavaScript to checkboxes or dropdown menus?
Yes. You can modify the script to check for a specific value rather than just an empty string. For example, you can check if a dropdown's event.value equals a specific selection to trigger the visibility of the next field.
Do I have to manually set the initial state of the dependent field every time?
Yes, you only need to do this once during the form creation process. Because the validation script only runs when the first field is modified by a user, setting the initial state to read-only or hidden ensures the form behaves correctly when it is first opened.




