Other PDF Issues

Disable a PDF Form Button After Locking Fields in Adobe Acrobat

Algirdas JasaitisAlgirdas Jasaitis Nov 19, 2026 868 views

Question details

The user wants to prevent a PDF form button from being used after JavaScript locks the form fields.

Product
Adobe Acrobat PDF forms
Device & OS
not provided
Scenario
A PDF form uses a button script to lock other form fields.
Observed behavior
The button remains visible and clickable after the other fields are locked.
Before you start

Open the form in Adobe Acrobat and identify the button’s exact field name in Prepare Form. Locate the existing button script and confirm where it finishes locking the fields.

Solution 1Recommended

Hide the button after the locking script runs

Use this method to remove the button from view once the existing script has successfully locked the form fields.

1
Open the button properties

In Acrobat, open Tools or All tools, select Prepare a form, and open the button’s Properties.

2
Edit the existing action

On the Actions tab, select the button’s JavaScript action, typically under Mouse Up, and click Edit.

3
Hide the button after locking

Near the end of the script, after the fields are locked, add: var btn = this.getField("Button"); if (btn) btn.display = display.hidden; Replace Button with the exact button field name.

4
Save and test the form

Save the PDF, open it in a JavaScript-enabled PDF viewer, and click the button. Confirm that the fields lock and the button disappears.

Hide the button after the locking script runs
Check viewer behavior: PDF JavaScript support varies by viewer. Setting a button to read-only may not reliably prevent its action from running, so test the actual workflow. Hiding the button is a usability measure, not a security control.
Free Microsoft Office alternative

Work with PDF forms and Office files in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for opening PDFs and working with Office files. Its format compatibility helps make migration straightforward, though it does not replace Acrobat’s PDF JavaScript configuration.

Open PDF forms in WPS PDFCompatible with Microsoft Word, Excel, and PowerPoint formats, including DOCX, XLSX, and PPTXFamiliar tools for working with documents and spreadsheetsFree and lightweight for everyday office tasks
QA img-9

Frequently Asked Questions

How do I find the PDF button’s field name?

Open Prepare a form in Acrobat, select the button, and check its name in Properties. Use that exact name in this.getField().

Will setting the button to read-only stop its JavaScript action?

Not reliably in every PDF viewer. Test the button’s actual behavior; hiding it after the locking script runs is a clearer way to prevent users from clicking it.

Why does the button disappear only after I save?

A Document Will Save action runs during saving. To hide the button immediately after locking, add the display.hidden code to the existing button script after the locking code.

Will the script work in every PDF viewer?

No. PDF viewers differ in their JavaScript support. Test the form in the viewer and save workflow your users will use.