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.
Copy link to clipboard
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:
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;
How would I fix this?
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.
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?
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.
Please follow the tips in this link: https://forums.adobe.com/thread/1237727
See here for briwf short answer:
dang it, never mind .... just switch the date and month there.
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?
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.
You have to do some serious readeing and figure out how the SignatureInfo object properties of the security handler works.
+++ 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; 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
Just a reminder: a digital signature is necessarily dated.