How to Add Automatic Dates and Save-As Restrictions in PDF Forms
Question details
A form creator needs to implement automatic date insertion via JavaScript when a checkbox is ticked, and force users to use 'Save As' instead of overwriting the original PDF.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating a fillable PDF checklist where dates auto-populate based on checkbox status, and the original file is protected from accidental user overwrites.
- Observed behavior
- Acrobat does not natively support locking the Save button while keeping Save As enabled. Additionally, the form requires custom automation to insert or clear dates dynamically based on user interaction.
Before adding custom JavaScript to your PDF form, ensure you have a backup of the original template file. Note that disabling the standard 'Save' function natively via script is restricted in most PDF editors due to security reasons.
Add Automatic Dates Using Custom JavaScript
Use a custom calculation script to insert the current date when a checkbox is checked and clear it when unchecked.
Since Adobe Acrobat allows custom JavaScript calculations, you can map a text field to monitor the status of a specific checkbox. When the checkbox changes state, the text field updates automatically.
Open your PDF form in Adobe Acrobat, go to 'Tools', and select 'Prepare Form'.
Right-click the specific date text field where the date should appear and select 'Properties'.
Navigate to the 'Calculate' tab, select the 'Custom calculation script' option, and click the 'Edit' button.
Enter the following script: if (this.getField('CheckBox').value != 'Off') { if (event.value == '') event.target.value = new Date(); } else { event.value = ''; } (Make sure to replace 'CheckBox' with the exact name of your checkbox field).
Go to the 'Format' tab within the same Properties window, select 'Date' from the format category, and choose your preferred date display style.

Prevent Overwriting by Setting the File to Read-Only
Because Acrobat cannot reliably disable the 'Save' command via JavaScript, making the original file and its folder read-only at the system level forces users to use 'Save As'.
Create, Edit, and Protect PDF Forms Easily with WPS Office
WPS Office provides a comprehensive PDF toolkit that allows you to manage fillable forms, restrict editing permissions, and protect your original templates without complex scripts.
- 1. Open Your PDF: Download and open WPS Office, then open your PDF form template.
- 2. Fill Form Fields: Navigate to the 'Form' tab to quickly interact with checkboxes, text fields, and dropdowns.
- 3. Apply Protection: Go to the 'Protect' tab to set a password and restrict document modifications, preventing accidental changes to the template structure.
- 4. Save as a New Copy: Use 'Menu' > 'Save As' to easily distribute the filled version while keeping your original template safe.

Frequently Asked Questions
Can I completely disable the 'Save' shortcut (Ctrl+S) in Acrobat using JavaScript?
No. Standard PDF readers block scripts from overriding application-level save commands for security reasons. Setting the file to read-only is the most reliable workaround to enforce the 'Save As' behavior.
Why isn't my JavaScript date formatting correctly?
Ensure that the text field properties under the 'Format' tab are explicitly set to 'Date' and that you have chosen a specific date display format. If the format is set to 'None', the raw JavaScript date string will be displayed instead.
Does this JavaScript calculation work in other PDF readers?
While standard JavaScript calculations are supported by major PDF editors like Adobe Acrobat, some lightweight or mobile PDF readers may not execute custom calculation scripts. Always test your form in the specific software your end-users will utilize.




