Copy link to clipboard
Copied
I have a form in which I want to prepopulate a field. Specifically load it with today's date. I have written a "document script" which does this. When the document loads, it works, but after doing a "reset form", it doesn't. What I find frustrating is that I have another form in which this works perfectly but I can't find the difference.
Any thoughts?
Copy link to clipboard
Copied
Here's a shorter script;
getField("Signature Date").value = util.printd("mm/dd/yyyy",new Date);
Since this is a document script, it only runs when the PDF is opened. For the field to automatically populate on a reset it would need to be a script on the reset button.
Copy link to clipboard
Copied
You'd need to post the form so we could look at it.
Copy link to clipboard
Copied
I'm a bit uncomfortable posting the entire form. Here is the field:
And here is the javascript:
var today = new Date();
var yyyy = today.getFullYear();
mm = today.getMonth() + 1; // Months start at 0!
dd = today.getDate();
if (dd < 10) dd = '0' + dd;
if (mm < 10) mm = '0' + mm;
var today = mm + '/' + dd + '/' + yyyy;
vsigdate=getField("Signature Date").value=today
Copy link to clipboard
Copied
Here's a shorter script;
getField("Signature Date").value = util.printd("mm/dd/yyyy",new Date);
Since this is a document script, it only runs when the PDF is opened. For the field to automatically populate on a reset it would need to be a script on the reset button.
Copy link to clipboard
Copied
Thank you. I don't know how I missed it.