• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Populate text field with current time upon signing

Community Beginner ,
Apr 08, 2016 Apr 08, 2016

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.

TOPICS
Acrobat SDK and JavaScript

Views

2.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Apr 09, 2016 Apr 09, 2016

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.

Votes

Translate

Translate
LEGEND ,
Apr 09, 2016 Apr 09, 2016

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 17, 2017 Jun 17, 2017

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 18, 2017 Jun 18, 2017

Copy link to clipboard

Copied

Why want you the name of the signature field?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 18, 2017 Jun 18, 2017

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 19, 2017 Jun 19, 2017

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 19, 2017 Jun 19, 2017

Copy link to clipboard

Copied

Look at SignatureInfo in the Acrobat JavaScript Reference.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 20, 2017 Jun 20, 2017

Copy link to clipboard

Copied

Thank you for your info.

I got it.

Thank you so much!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 11, 2023 May 11, 2023

Copy link to clipboard

Copied

LATEST

@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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines