PDF Security & Access Issues

Lock and Unlock LiveCycle PDF Form Fields with JavaScript

John WilsonJohn Wilson Nov 19, 2026 868 views

Question details

The user wants to prevent recipients from changing completed fields in a LiveCycle Designer PDF form.

Lock and Unlock LiveCycle PDF Form Fields with JavaScript
Product
Adobe LiveCycle Designer
Device & OS
not provided
Scenario
A form designer wants to lock completed fields and, if needed, unlock them using form scripting.
Observed behavior
Completed fields should become read-only while the form remains usable for its intended workflow.
Before you start

Open the source form in LiveCycle Designer and identify the fields and controls that will trigger locking or unlocking. Test the saved form in a PDF viewer that supports XFA forms and JavaScript; browser PDF viewers may not run the scripts.

Solution 1Recommended

Set LiveCycle form fields to read-only with JavaScript

Use form scripting to control whether a field can be edited during a supported PDF form session.

This is a user-interface control, not reliable security. A recipient who can trigger the unlock script or modify the form with specialized tools may be able to change the data.

1
Select a trigger

In LiveCycle Designer, open the form and select the button or other object that should lock the completed field.

2
Open the script editor

Open the Script Editor, select an appropriate event such as the button's click event, and set the script language to JavaScript with execution on the client.

3
Add the lock script

Enter a script such as xfa.resolveNode("form1.Page1.CustomerName").access = "readOnly"; and replace the example path with the target field's actual XFA path. Add a line for each field you want to lock.

4
Add an unlock control if needed

For a separate unlock button's click event, use the same field path with access = "open". Do not expose this control to recipients if they should not be able to unlock the field.

5
Save and test

Save the form as a PDF, open it in an XFA-compatible viewer, complete the field, and use the controls to verify that locking and unlocking work as expected.

Set LiveCycle form fields to read-only with JavaScript
Client-side scripts are not tamper-proof: Hiding an unlock button or relying on JavaScript does not guarantee that recipients cannot alter the form. Use additional document controls when integrity is critical.
Free Microsoft Office alternative

Work with everyday documents and PDFs in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for working with common Office documents and PDFs. Its format compatibility helps you move existing files into a new workflow. It does not replace LiveCycle Designer for creating or controlling XFA form scripts, so check form compatibility before sharing.

Open and review common PDF documents alongside Office filesCompatible with Microsoft Word, Excel, and PowerPoint formats, including DOCX, XLSX, and PPTXFamiliar interface for a smoother transition from Microsoft OfficeFree, lightweight option for everyday document work
microsoft office alternative - wps office

Frequently Asked Questions

Can JavaScript make a LiveCycle form field read-only?

Yes. In LiveCycle Designer's Script Editor, set the target field's XFA access property to "readOnly" from an appropriate event, such as a button click.

How do I make a locked field editable again?

In an unlock control's JavaScript event, set the same field's access property to "open". Anyone who can use that control may be able to unlock the field.

Why doesn't the lock button work in a browser PDF viewer?

Many browser viewers do not support XFA forms or their JavaScript. Open the PDF in an XFA-compatible viewer and test the button there.

Does an editing password guarantee that completed fields cannot be changed?

No. PDF editing permissions can be bypassed by specialized tools. For critical integrity requirements, consider a digital signature or a managed document-control workflow.