How to Make PDF Form Fields Read-Only After Applying a Dynamic Stamp
Question details
The user needs to lock fillable PDF form fields automatically after a dynamic stamp is applied to the document.

- Product
- PDF Editor
- Device & OS
- not provided
- Scenario
- Finalizing a fillable PDF form with an approval or dynamic stamp to prevent further modifications to the fields.
- Observed behavior
- Applying a standard dynamic stamp leaves the form fields editable, requiring manual intervention to make them read-only.
Ensure your PDF editor supports JavaScript execution and that you have administrative or editing access to modify the custom calculation scripts of your dynamic stamps.
Use Custom JavaScript to Lock Form Fields Automatically
Embed a JavaScript snippet into your dynamic stamp's configuration to set all document fields to read-only as soon as the stamp is placed.
Standard dynamic stamps do not inherently alter document properties. By attaching a custom script to the stamp, you can automate the process of securing the document. This is highly useful for approval workflows where a stamp acts as a finalized signature.
Access your PDF editor's stamp management tool, navigate to your custom stamps, and select the dynamic stamp you wish to modify.
Open the custom calculation script or JavaScript configuration section specifically tied to that dynamic stamp.
Add a JavaScript loop to iterate through the document and lock the fields. For example: `for (var i = 0; i < this.numFields; i++) { this.getField(this.getNthFieldName(i)).readonly = true; }`.
Save the updated stamp settings. Apply the stamp to a test fillable PDF to verify that all fields successfully become read-only upon placement.

Manage and Secure PDF Forms Easily with WPS Office
WPS PDF provides comprehensive tools for creating, filling, and securing fillable forms. You can easily manage permissions, add custom stamps, and protect your documents from unauthorized editing.
- 1. Open WPS PDF: Launch WPS Office and open your fillable PDF document.
- 2. Add a Stamp: Navigate to the 'Comment' tab and select 'Stamp' to apply your desired approval or custom stamp to the document.
- 3. Protect the Document: Go to the 'Protect' tab and select 'Restrict Editing' or 'Encrypt' to lock the document and prevent users from modifying the form fields manually.

Frequently Asked Questions
Why aren't my form fields automatically locked after stamping?
Standard dynamic stamps are designed only to add visual elements and metadata (like date or time) to the PDF. They do not inherently change document properties or field states unless custom JavaScript is applied to trigger those changes.
Can I lock only specific form fields instead of the entire document?
Yes. By modifying your JavaScript code, you can target specific field names to make read-only, leaving other parts of the form editable for subsequent users in your workflow.
Is it possible to unlock the fields after they have been set to read-only?
Once locked via the script, a user would need appropriate document editing permissions and professional PDF software to manually change the field properties back to an editable state.
Does this JavaScript method work in all PDF viewers?
The script relies on the viewer's ability to execute JavaScript. While robust PDF editors support this, some lightweight browser-based viewers or mobile apps might not execute the locking script correctly.




