Skip to main content
Participant
October 18, 2012
Answered

Can Acrobat auto populate a date field upon digital signature of a form?

  • October 18, 2012
  • 3 replies
  • 67808 views

We use several fillable forms with digital ID signature fields.  A business rule requires a date field next to the signature field.  Is it possible to define the date field to auto populate once the user signs the form?  I can't check this in Acrobat since I only have the reader.

This topic has been closed for replies.
Correct answer Steven_Madwin

Hi,

The short answer is yes, but of course you'll need to get Acrobat to edit the PDF file.

Generically, here is what  you are looking to do:

  1. Open the Digital Signature Properties dialog
  2. Select the Signed tab
  3. Select the This script executes when the field is signed radio button
  4. Click the Edit button
  5. Add the code snippet below to the JavaScript editor
  6. Click the OK button on the JavaScript editor
  7. Click the Close button on the Digital Signature Properties dialog

// JavaScript code to add the date at signing time

    var currentTime = new Date()

    var month = currentTime.getMonth() + 1

    var day = currentTime.getDate()

    var year = currentTime.getFullYear()

    var signingTime = day +"/"+month+"/"+year  //Modify into your preferred format

    var f = this.getField("Text1");  //Modify the field name as necessary

    f.value = signingTime;

Good luck,

Steve

3 replies

JR Boulay
Community Expert
Community Expert
April 25, 2020

Just a reminder: a digital signature is necessarily dated.

😉

Acrobate du PDF, InDesigner et Photoshopographe
Participant
April 25, 2020

I'm wondering if there's a way to do a similar thing but with the signers name? Is there script that will pull the individuals name from the signature and auto populate it into a designated text box?

ls_rbls
Community Expert
Community Expert
April 26, 2020

Yes you can but is complicated.

 

I asked this question before in an older thread.

 

In the case of government forms,  the individual who signs have to apply a digital signature to many fields and also type in printed name and select date.

 

This is time consuming so it is possible to get signature and date  information.

 

This is vaguely covered in the Adobe Acrobat DC  SDK - Developing Acrobat Applications Using Javascript, "Getting Signature Information from another user", pages 163-165.

 

You have to do some serious readeing and figure out how the SignatureInfo object properties of the security handler works.

 

You'll need also to read about SeedValue  and the SecurityHandler object found in the Acrobat JavaScript Scripting Reference, "Field Methods", pages 270-275.

 

Steven_Madwin
Adobe Employee
Steven_MadwinCorrect answer
Adobe Employee
October 19, 2012

Hi,

The short answer is yes, but of course you'll need to get Acrobat to edit the PDF file.

Generically, here is what  you are looking to do:

  1. Open the Digital Signature Properties dialog
  2. Select the Signed tab
  3. Select the This script executes when the field is signed radio button
  4. Click the Edit button
  5. Add the code snippet below to the JavaScript editor
  6. Click the OK button on the JavaScript editor
  7. Click the Close button on the Digital Signature Properties dialog

// JavaScript code to add the date at signing time

    var currentTime = new Date()

    var month = currentTime.getMonth() + 1

    var day = currentTime.getDate()

    var year = currentTime.getFullYear()

    var signingTime = day +"/"+month+"/"+year  //Modify into your preferred format

    var f = this.getField("Text1");  //Modify the field name as necessary

    f.value = signingTime;

Good luck,

Steve

rsimpson258
Participant
July 18, 2018

I was able to get the date to populate correctly! Thank you @Steven.Madwinfor the helpful information. One more thing I would like to ask of you. Now that I have the date auto populating on the form when digitally signed, how do I make the form read only at the same time it is digitally signed? I am not able to select "Mark as read-only" and "This script executes when field is signed" buttons at the same time. Is it even possible?

ls_rbls
Community Expert
Community Expert
October 7, 2019
Thank you Steven for the assistance. I have completed the date field, but also want to make fields read only. However, I have 3 different signature fields on my form and would only like to make certain fields read only once the signatures and signed in sequence. Thank you for your assistance.
Hi, I see this is an old thread. Adding to the suggestions above, I used this script in "Actions" --->>> Run a javascript instead. It worked for me : this.getField("yourotherTextField).value = util.printd ("yyyymmdd", new Date()); and then in the textfield that you want this date from signing time use Custom Calculation Script adding this line: var s = this.getField("SignatureField").value; if (s=="") event.value = ""; To only make certain fields read-only , right-click on the signature field---> Properties---> Digital Signature Properties---> click on the "Signed" tab. Then slect the radio button that is labeled "Mark as read-only:" . The pulldown menu that appears greyed out next to it wil become active and you will be able to choose "just these fields". An itemized list will open will all the fields in your document than you can tick or untick to select specifically which ones you want as read-only after a digital signature is applied.