PDF Editing Issues

How to Add Automatic Dates and Save-As Restrictions in PDF Forms

Tauseeq MagsiTauseeq Magsi Nov 2, 2026 868 views

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.

How to Add Automatic Dates and Save-As Restrictions in PDF Forms
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 you start

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.

Solution 1Recommended

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.

1
Enter Prepare Form Mode

Open your PDF form in Adobe Acrobat, go to 'Tools', and select 'Prepare Form'.

2
Open Field Properties

Right-click the specific date text field where the date should appear and select 'Properties'.

3
Add Calculation Script

Navigate to the 'Calculate' tab, select the 'Custom calculation script' option, and click the 'Edit' button.

4
Paste the Custom JavaScript

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).

5
Configure Date Format

Go to the 'Format' tab within the same Properties window, select 'Date' from the format category, and choose your preferred date display style.

Add Automatic Dates Using Custom JavaScript
Testing the Script: Close the form editing mode and toggle the checkbox to ensure the date appears and disappears exactly as expected.

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. 1. Open Your PDF: Download and open WPS Office, then open your PDF form template.
  2. 2. Fill Form Fields: Navigate to the 'Form' tab to quickly interact with checkboxes, text fields, and dropdowns.
  3. 3. Apply Protection: Go to the 'Protect' tab to set a password and restrict document modifications, preventing accidental changes to the template structure.
  4. 4. Save as a New Copy: Use 'Menu' > 'Save As' to easily distribute the filled version while keeping your original template safe.
Seamlessly open, fill, and save PDF forms with full compatibility across standard PDF formats.Easily apply document passwords and restrict editing or saving to protect your original templates.Cross-platform support ensures your PDFs work perfectly on Windows, Mac, iOS, and Android devices.
microsoft office alternative - wps office

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.