Disable a PDF Form Button After Locking Fields in Adobe Acrobat
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.
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.
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.
In Acrobat, open Tools or All tools, select Prepare a form, and open the button’s Properties.
On the Actions tab, select the button’s JavaScript action, typically under Mouse Up, and click Edit.
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.
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 when a locked form is saved
Use a Document Will Save action if the button should disappear during saving, but only after a known field has been locked.
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.

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.




