Skip to main content
Known Participant
June 23, 2021
Question

Cannot get date to auto-populate to today's date like I did on other documents before

  • June 23, 2021
  • 1 reply
  • 2401 views

I did a search a while back for how to get the date to autopopulate to today's date. I found an article that gave me this javascript to use (I do know know anything about java script so this was completely new).

 

This is the script: var f = this.getField("Today's Date");f.value = util.printd("mmm d, yyyy", new Date());

 

I created a text field, labled it "Today's Date". Clicked on the Javascript tool, then on Document Javascripts, names the script "Today's Date" and then put in the script and it worked.

 

I am copied and pasted that script and followed the same process for other documents and it has always worked.

 

Not now, I am trying to do the same and it's not working.

 

I tried clicking on Debugger just to see what that was (I have no idea what I'm doing) and this is what it showed:

 

 

Can someone help please? I would sure appreciate it!

This topic has been closed for replies.

1 reply

Bernd Alheit
Community Expert
Community Expert
June 23, 2021

The name of the field is not correct.

Known Participant
June 23, 2021

Thank you Bernd.

 

Can you explain a little more?

 

I have always used "Today's Date". What am I missing?

Bernd Alheit
Community Expert
Community Expert
June 23, 2021

this.getField("Today's Date");

gives the value null.

That means that the script doesn't find the field in the document.