Lock PDF Form Fields Until Previous Fields Are Completed in Adobe Acrobat
Question details
The user wants later PDF form fields to remain read-only until earlier fields are completed.

- Product
- Adobe Acrobat PDF forms
- Device & OS
- not provided
- Scenario
- A form author wants to guide users through fields in a required sequence.
- Observed behavior
- Each subsequent field should become editable only after all preceding fields contain values.
Open the PDF in an Acrobat version that supports editing form fields and JavaScript, and identify the exact names of the text fields in their intended order. Test the finished form in the PDF viewers your users will use, because JavaScript support varies.
Use an Acrobat calculation script to unlock fields in order
Use this method to make text fields editable in sequence while keeping later fields read-only.
The example checks that each preceding text field contains a nonblank value. It does not check whether a value is valid, and read-only fields are not a security control.
In Adobe Acrobat, open the PDF and choose Prepare a form. Create or select three text fields and name them Step1, Step2, and Step3 in their Properties dialogs.
Open Properties for Step2 and Step3 and select Read Only on the General tab. Leave Step1 editable.
In Prepare a form, add another text field named SequenceControl. In its Properties, set its visibility to Hidden, then open the Calculate tab, select Custom calculation script, and click Edit.
Paste the following into the JavaScript editor and confirm the dialog: var names = ["Step1", "Step2", "Step3"]; var unlocked = true; for (var i = 0; i < names.length; i++) { var f = this.getField(names[i]); f.readonly = !unlocked; if (f.valueAsString.replace(/^\s+|\s+$/g, "") === "") unlocked = false; } event.value = ""; Replace the names in the array if your fields have different names.
Save the PDF and use Preview in Prepare a form. Enter a value in Step1 and leave the field to check that Step2 unlocks; repeat for Step2 and Step3. Then clear an earlier field and verify that later fields become read-only again.

Work with PDF Forms and Office Files in WPS Office
WPS Office is a free, lightweight alternative for working with PDFs and Office documents in a familiar interface. It can help users open and fill PDF forms, but it does not replace Acrobat's JavaScript setup for the sequential locking described here.

Frequently Asked Questions
What happens if someone clears an earlier field?
The example calculation makes subsequent fields read-only again, but their existing values remain. Test this in Acrobat's Prepare a form preview and add separate clearing or validation logic if those values should not be submitted.
Does a read-only field prevent someone from changing the PDF?
No. The Read Only property guides form interaction; it is not a security measure. Use appropriate document security and server-side validation if the data must be protected or enforced.
Why might the fields stay locked in another PDF viewer?
The sequence depends on PDF JavaScript and form calculations, which some viewers do not support or may disable. Test the saved PDF in the intended viewer, including Adobe Acrobat or Acrobat Reader.
Can the script check more than three fields?
Yes. In the custom calculation script, add the exact field names to the names array in the required order. Set every field except the first to Read Only initially in its Properties dialog.




