Copy link to clipboard
Copied
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.
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:
// JavaScript code to add the date at signin
...Copy link to clipboard
Copied
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:
// 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
Copy link to clipboard
Copied
I've got the JavaScript to work but I don't know enough about it to fix the issue I'm encountering with the month and day being switch. For example, if i sign the form today, the date populated is showing October 12, 2015.
How would I fix this?
Copy link to clipboard
Copied
Google is your friend. See http://stackoverflow.com/questions/3552461/how-to-format-a-javascript-date
Copy link to clipboard
Copied
Go into the properties of the field that you have the date populating in. Click the "Format" tab and select the date format category. After that you will scroll all the way down to the bottom of the box with the date formats and select "Custom". It will populate a field just below it that will allow you to write the date format as you see fit.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
Hi rsimpson258,
Since you are digitally signing the file, as long as it's the last signature field being signed you have the option to lock the document, which effectively makes all of the form controls read-only. Select this checkbox circled below and the file will end up being read-only.
Steve
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi,
Please follow the tips in this link: https://forums.adobe.com/thread/1237727
See here for briwf short answer:
https://acrobatusers.com/forum/forms-acrobat/populate-other-fields-date-digital-signature/
And here:
Copy link to clipboard
Copied
I know this is an old thread but I know nothing about javascript and could use some assistance. The code works just as needed for me except for the date format, so how do I change it so the date is formatted as MM/DD/YYYY?
Copy link to clipboard
Copied
dang it, never mind .... just switch the date and month there.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
+++ EDITED REPLY (some corrections made)
As a matter of fact yes. If you read the referenced pages that I posted earlier you can get the Distinguished Name from the digital certificate used in the signature field (there are more code examples in Page 334).
To do so declare a variable using the "signatureInfo()" to call the signatureInfo Object and also decalre a variable with "sigInfo" to pull from the signatureInfo object the Distinguished Name label that was used in the digital certificate of the digital ID.
In your signature field, select Properties from the context menu and go to the "Sign" tab. Then tick the radio button "This script executes when field is signed" and place the following script there as shown in the slide below:
var f = this.getField("Signature");
var sigInfo = f.signatureInfo();
var cert = sigInfo.certificates[0];
this.getField("Text1").value = cert.subjectDN.cn;
The script will copy the Distinguished Name label to the field "Text1" in my example above.
Copy link to clipboard
Copied
This works amazing. However, it displays the signature number after. How do you make it so that it only displays the signature name?
Copy link to clipboard
Copied
Do you mind sharing a screenshot?
I am not sure if you're referring to a government issued digital certificate embedded in a smart card.
In which case, I would assume that the number that you're referring to is the EDIPI that is appended at the end sperated by periods, correct?
Copy link to clipboard
Copied
I forgot to add this valuable thread:
Copy link to clipboard
Copied
Just a reminder: a digital signature is necessarily dated.
😉