Copy link to clipboard
Copied
Hi
I have used the following script from another thread to auto populate a text field with current date upon signing of a PDF form:
// 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;
(Original thread Can Acrobat auto populate a date field upon digital signature of a form?‌ I didn't want to ask on there since the thread was so old.)
This is working fine but I also want to add the current time to the box. This is to validate when a document was signed before being submitted and will work on 3 different signatures.
Any ideas would be much appreciated.
A timestamp will be included as part of each digital signature, so this is redundant, but you script can be much simpler:
getField("Text1").value = util.printd("dd/mm/yyyy HH:MM", new Date());
More information on the util.printd method and the format characters you can use is in the Acrobat JavaScript reference.
Copy link to clipboard
Copied
A timestamp will be included as part of each digital signature, so this is redundant, but you script can be much simpler:
getField("Text1").value = util.printd("dd/mm/yyyy HH:MM", new Date());
More information on the util.printd method and the format characters you can use is in the Acrobat JavaScript reference.
Copy link to clipboard
Copied
Do you know the javascript code for the "fullname" instead?
I also try to get the full name of the signature field and display next to the signature & date fields but I don't know how. Please help.
Thanks!
Copy link to clipboard
Copied
Why want you the name of the signature field?
Copy link to clipboard
Copied
our fillable form has a name field, it also use for wet signature so the signer can input his/her name there.
Do you know how to create javascript code to populate the full name when it singing?
Thank you in advance!
Copy link to clipboard
Copied
I try the javascript code:
this.getField("Name").value = this.getField("Signature").value;
or
getField("Name").value = getField("Signature").value;
But they show: <<dict>> on the name field
What that mean?
Do you know what is the format or code for "Signature name"?
Thank you in advance!
Copy link to clipboard
Copied
Look at SignatureInfo in the Acrobat JavaScript Reference.
Copy link to clipboard
Copied
Thank you for your info.
I got it.
Thank you so much!
Copy link to clipboard
Copied
@adaptable_Eclipse15A8 could you assist with this? I'm in the military and, even though it's redundant, it's required that the date match the digital signature from a certificate. Your code appears to be at the time of printing and I need it to be at the time of signing. I'm a beginner at javascript so I'm sure I'm totally off base with that assumption. I also can't get it to work. Do I need it to be on blur, mouse up/down...etc?