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

Today's data

Community Beginner ,
Sep 08, 2020 Sep 08, 2020

I have a form that when opened, there is a "Today's Date" field that is supposed to grab the date. But it is not updating. It got a date of 03/18/2020 in there. I don't know where that date is coming from.

 

I followed this article, but no luck.

https://answers.acrobatusers.com/add-automated-today-date-form-javascript-q118604.aspx

 

I am using Adobe Acrobat Pro DC Version 2020.012.20043. Any help would be appreciated.

TOPICS
Acrobat SDK and JavaScript
486
Translate
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
LEGEND ,
Sep 08, 2020 Sep 08, 2020

Is that field clickable or editable with a date picker? or is it read-only?

 

Is this field also used in a date calculation with other date fields? 

 

Have you checked if during form editing another datefield was rename with this same fieldname and now is grabbing that other's field's value?

 

And if you use CTRL+J to open the  debugger console what error(s) can you spot?

Translate
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 Beginner ,
Sep 08, 2020 Sep 08, 2020

 

Is that field clickable or editable with a date picker? or is it read-only? Read-only

 

Is this field also used in a date calculation with other date fields? 

JobAppDateFieldProperty-Calculuation.PNG

Have you checked if during form editing another datefield was rename with this same fieldname and now is grabbing that other's field's value? I did duplicate the field to a second page.

 

And if you use CTRL+J to open the  debugger console what error(s) can you spot?

TypeError: f is null
4:Document-Level:dateToday

 

Translate
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 ,
Sep 08, 2020 Sep 08, 2020

That means a field name specified in the code of that function is incorrect.

You should be able to find it under Tools - JavaScript - Document JavaScripts.

Translate
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
LEGEND ,
Sep 08, 2020 Sep 08, 2020
LATEST

As try67 mentioned, verify if the field name used in the script need to be changed to the actual date field in your PDF.

 

You said you have a "Today's Date" field , but in the script referenced in the link that you shared that date field name is spelled "todayDate". Make suer  that the date field name is spelled in the same way in the script like this:

 

function dateToday() {
    var d = new Date();
    f = this.getField("Today's Date");
    f.value = d;
}

dateToday();
Translate
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