How to Fix a Distributed PDF Form Not Locking After Submission
Question details
The user needs to figure out why an email-based distributed PDF form stopped locking responses after submission following a recent JavaScript modification.

- Product
- PDF Editor
- Device & OS
- not provided
- Scenario
- Editing form behaviors and scripts in a distributed PDF form.
- Observed behavior
- The PDF form no longer locks completed fields upon submission, allowing subsequent unwanted modifications.
Ensure you have access to both the currently modified PDF form and a backup of the original working version before the JavaScript edits were made.
Review and Debug the Modified JavaScript
Identify if the recent script edit introduced syntax errors or altered the specific locking function.
When a previously working form stops locking upon submission after a script edit, a JavaScript bug is the most likely culprit. An error might be interrupting the script execution before it reaches the locking command, or the locking logic itself was accidentally removed.
Open your PDF editor's JavaScript debugger or console to check for any runtime errors triggered during the submission process.
Place the old working code and the new modified code side-by-side to pinpoint exactly what logic was altered or removed.
Ensure that the script explicitly contains the command to make fields read-only (e.g., setting the 'readonly' property to true) and that it executes successfully before the submit action.

Check Form Distribution Workflow Settings
Ensure the form's submit button properties and distribution configurations haven't been accidentally altered.
Edit and Protect PDF Forms with WPS Office
Avoid complex JavaScript debugging by using WPS PDF to seamlessly create, edit, and encrypt your PDF forms. WPS Office provides intuitive tools to restrict editing and secure your documents without writing a single line of code.
- 1. Open the PDF in WPS Office: Launch WPS Office and open your PDF form file.
- 2. Navigate to the Protect Tab: Click on the 'Protect' tab in the top ribbon to access document security features.
- 3. Restrict Editing: Select 'Encrypt' to set a permissions password. Check the option to restrict editing and printing, effectively locking your form fields from further changes.
- 4. Save and Distribute: Save the secured PDF document and distribute it to your users securely.

Frequently Asked Questions
Can I lock specific fields in a PDF form instead of the whole document?
Yes, you can configure individual form field properties to be 'Read Only' under the field's properties dialog. Using JavaScript, you can dynamically set specific fields to read-only while leaving others editable.
Why does my PDF form submit script work but not the lock script?
This usually happens if the locking script contains a syntax error, or if it is placed after the submit action in the execution queue. The form submission might terminate the script sequence before the locking commands can run.
How do I make a PDF form read-only without using JavaScript?
You can restrict editing by applying a permissions password to the PDF. By configuring the security settings to disallow changes in your PDF editor, users will only be able to view or print the document after it's saved.




