Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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?
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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();