Lock PDF Form Fields After Completing a Text Field in Adobe Acrobat
Question details
The user wants to make PDF form fields read-only after a text field is completed and the user confirms the form is finished.

- Product
- Adobe Acrobat and Adobe Acrobat Reader
- Device & OS
- not provided
- Scenario
- A PDF form contains entered values that should no longer be edited after the user confirms completion.
- Observed behavior
- The desired result is to lock regular form fields while leaving buttons and signature fields available.
Open the PDF in Adobe Acrobat and identify the exact name of the text field that must be completed. JavaScript must be enabled in the PDF viewer for the button action to run.
Add a confirmation button that locks completed PDF form fields
Use a button and an Acrobat JavaScript action to check a required text field and make non-button, non-signature fields read-only.
This method marks fields as read-only rather than flattening the PDF. It helps prevent accidental changes but is not a security guarantee against someone who can modify the form.
In Adobe Acrobat, open the PDF and select Prepare a form. Check the required text field's name in its properties.
In Prepare a form, add a button to the page, give it a name, and open its Properties. Set a label such as Finalize Form.
In Button Properties, open Actions. Set Select Trigger to Mouse Up and Select Action to Run a JavaScript, then click Add. Paste the following script and replace CompletionText with the exact name of your required text field: var required = this.getField("CompletionText"); if (!required || /^\s*$/.test(required.valueAsString)) { app.alert("Complete the required text field before finalizing the form."); } else if (app.alert("Finalize the form and make its fields read-only?", 2, 2) === 4) { for (var i = 0; i < this.numFields; i++) { var field = this.getField(this.getNthFieldName(i)); if (field && field.type !== "button" && field.type !== "signature") { field.readonly = true; } } }
Close Button Properties and save the PDF. Open it in Acrobat or Reader, complete the required field, click Finalize Form, and confirm. Check that regular fields are read-only and that buttons and signature fields remain available, then save the completed PDF.

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 files. Its Microsoft Office format compatibility helps with migration, but it does not replace the Acrobat JavaScript setup described above.

Frequently Asked Questions
Can the form lock fields automatically when text is entered?
A field event can trigger JavaScript, but the button method lets the user confirm that the entire form is complete before the fields become read-only.
Why are button and signature fields excluded?
The script checks each field's type and skips buttons and signature fields so users can still use buttons or apply a signature after finalizing the other fields.
Will the button work in every PDF viewer?
No. The action requires support for Acrobat JavaScript and may be affected by viewer settings. Test it in the Acrobat or Reader version your users will use.
Does making fields read-only securely protect the form?
No. Read-only fields help prevent accidental editing, but someone with suitable tools or permissions may be able to change them. Consider a digital signature or other appropriate PDF security controls when stronger protection is needed.




