PDF Security & Access Issues

Unlock PDF Form Fields with a Password in Adobe Acrobat

Chanuka GeekiyanageChanuka Geekiyanage Nov 19, 2026 869 views

Question details

The user wants a PDF button to request a password and make selected form fields editable when the password is correct.

Unlock PDF Form Fields with a Password in Adobe Acrobat
Product
Adobe Acrobat
Device & OS
not provided
Scenario
A PDF form contains fields that should initially be read-only and become editable after a password check.
Observed behavior
The desired behavior is for the button to prompt for a password and unlock the specified fields only when it matches.
Before you start

Open the PDF in an edition of Adobe Acrobat that can edit forms, and identify the exact names of the fields you want to unlock. The PDF viewer used to test the form must support Acrobat JavaScript.

Solution 1Recommended

Add a password prompt to an Acrobat form button

Use a button action to check a password and change selected fields from read-only to editable.

The button that displays the prompt must remain clickable; it unlocks the fields rather than enabling itself.

This is only a user-interface restriction. The password is stored in the PDF script and can be discovered, so do not use it to protect sensitive information.

1
Set the fields to read-only

Open the PDF in Acrobat and select All tools > Prepare a form. Open each target field's Properties, select the General tab, and check Read Only. Note each field's exact name.

2
Create the unlock button

In Prepare a form, add a button or open an existing button's Properties. Give it a label such as Unlock Fields, and leave the button itself available for clicking.

3
Add the JavaScript action

In the button's Properties, open Actions. Set the trigger to Mouse Up and the action to Run a JavaScript, then click Add. Enter this script: var cResponse = app.response({cQuestion: "Enter the password", cTitle: "Password"}); if (cResponse == null) { app.alert("Password entry canceled."); } else if (cResponse === "123456") { this.getField("LockedField1").readonly = false; this.getField("LockedField2").readonly = false; } else { app.alert("Invalid password."); }

4
Customize and test

In the script editor, replace 123456 and the field names with your own values. Add another this.getField("FieldName").readonly = false; line for each additional field. Save the PDF, exit form editing, and click the button to test correct, incorrect, and canceled responses.

Add a password prompt to an Acrobat form button
This is not secure password protection: Unicode-encoding the password only obscures it; it does not secure it. For sensitive documents, use Acrobat's password protection and permissions instead, recognizing that document-level protection does not provide the same per-field workflow.
Free Microsoft Office alternative

Work with PDFs and Office files in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and Office files. Its format compatibility makes it easier to move existing documents into your workflow, though it does not implement this Acrobat-specific JavaScript solution.

Open and review PDF documents alongside your other files.Work with Microsoft Word, Excel, and PowerPoint formats, including DOCX, XLSX, and PPTX.Use a familiar interface to make migration from Microsoft Office easier.Get started with a free, lightweight office suite.
microsoft office alternative - wps office

Frequently Asked Questions

Can one password unlock several PDF form fields?

Yes. In the button's Run a JavaScript action, add a separate this.getField("FieldName").readonly = false; statement for each field, using its exact form-field name.

Why does nothing happen when I click the button?

Check the button's Properties > Actions to confirm that Mouse Up runs the JavaScript. Also test the PDF in a viewer that supports Acrobat JavaScript; browser and other PDF viewers may not run the script.

Is the password in the JavaScript secure?

No. Someone inspecting the PDF script may find the password. Unicode encoding only obscures the value and does not provide real protection.

What should I do if a field does not unlock?

In Acrobat's Prepare a form tool, check the field name in its Properties and make sure it exactly matches the name in this.getField(). Also confirm that the correct password was entered.

Does this method enable the password button itself?

No. The password button must be clickable to display the prompt. Its script then makes the specified read-only fields editable after a correct response.