How to Automatically Add a Date When Digitally Signing a PDF
Question details
The user needs to configure a PDF document so that the current date is automatically populated into a designated text field when a digital signature is applied.

- Product
- Adobe Acrobat PDF Form
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form that requires users to provide a dated digital signature upon completion.
- Observed behavior
- A script must be triggered to capture the exact time of signing and display the formatted date within a separate target text box on the document.
Ensure you have a PDF editor that supports JavaScript for form fields, such as Adobe Acrobat Pro, and that your PDF already contains both a digital signature field and a target text field for the date.
Use JavaScript on the Signature Field's Signed Event
Attach a custom JavaScript action to the digital signature field so that it automatically fills in the current date when the user signs the document.
By leveraging Adobe Acrobat's form field properties, you can configure a script that executes precisely when the signature is applied. This ensures the date field perfectly matches the time of signing.
Make sure you know the exact name of your target date field (e.g., 'Text1') before writing the script, as the code will need to reference it directly.
Open your PDF form in preparation mode. Right-click the target Digital Signature field and select 'Properties' from the context menu.
In the Properties dialog box, click on the 'Signed' tab located at the top right of the window.
Select the radio button that says 'This script executes when field is signed', and then click the 'Edit' button to open the JavaScript editor.
Type or paste the following code into the editor: var d = new Date(); this.getField("Text1").value = d.getDate() + "/" + (d.getMonth() + 1) + "/" + d.getFullYear();
Replace "Text1" in the code with the actual name of your date text field. Click 'OK' to close the editor, then save the document.
Apply a test digital signature to the document to verify that the target text box automatically populates with the current date.

Easily Sign and Date PDFs Using WPS Office
Skip the complex JavaScript code. WPS PDF allows you to add secure digital signatures that inherently display a timestamp and date directly within the signature block.
- 1. Open Your PDF: Launch WPS Office and open the PDF document you need to sign.
- 2. Access the Protect Tab: Navigate to the 'Protect' tab located on the top toolbar and click on 'Sign Document' or 'Digital Signature'.
- 3. Select or Create Digital ID: Choose your existing digital ID certificate from the list, or follow the prompts to create a new one.
- 4. Place the Signature: Click on the designated area in your document to place the signature. WPS Office will automatically embed the current date and timestamp into the visual signature block.

Frequently Asked Questions
Does a digital signature automatically include a date?
Yes, standard digital signatures inherently contain a cryptographic timestamp of exactly when they were applied. However, inserting the date into a separate, highly visible text field requires additional scripting.
Can I automatically populate the signer's name using JavaScript too?
Yes, advanced JavaScript can be written to extract the signer's identity details from the digital certificate and auto-populate that information into a designated text box upon signing.
Why isn't my JavaScript executing when I sign the PDF?
JavaScript execution might be disabled in your PDF reader's security preferences. You must ensure that JavaScript is enabled in your software settings and that the document trusts the script.
Do I need premium software to add custom JavaScript to PDF forms?
Yes, adding embedded JavaScript to specific form field events, like the 'Signed' tab, typically requires advanced PDF authoring software such as Adobe Acrobat Pro.




