Copy link to clipboard
Copied
I have a for that has an auto updating date field using the following script: getField("Date").value = util.printd("dd-mmm-yyyy", new Date()); The problem is once the form is completed and saved under a different name it continues to update the date field every time it is opened. I need this form to udate the date only the first time it is opened any subsequent time the form is opened I need it to retain the original date from when the form was completed and saved.
Would anyone be able to provide some guidance as to how to alter this field or create a new field that will only set the date once.
I am using Adobe Acrobe Pro 2017 release date and the form needs to support digital signature
Any help would be greatly appreciated.
Copy link to clipboard
Copied
Use this code:
if (this.getField("Date").valueAsString=="") this.getField("Date").value = util.printd("dd-mmm-yyyy", new Date());
Copy link to clipboard
Copied
Thanks for your response and it seem to work with regards to not altering the date but it seems to be picking up the current date now and storing that in the document. I need to save the document is such a manner so that when someone downloads it and then opens the pdf, it fills in the current date for the user at that time.
I know very little about this so I may be doing something wrong.
Copy link to clipboard
Copied
Just reset the form and then save it before uploading it to the server.
Copy link to clipboard
Copied
Sorry to ask probably a stupid question but how would one reset the form before submitting uploading it to the server that it will be housed on.
Copy link to clipboard
Copied
Not submitting it, uploading it to the server... It's not the same.
You would do it by opening it in Acrobat, then going to Tools - Forms - More Form Options - Clear Form.
You can also do it by running this code from the JS Console:
this.resetForm();
Copy link to clipboard
Copied
Thanks for your response and it seem to work with regards to not altering the date but it seems to be picking up the current date now and storing that in the document. I need to save the document is such a manner so that when someone downloads it and opens it fills in the current date for the user at that time.
I know very little about this so I man be doing something wrong.
Copy link to clipboard
Copied
On what kind of devices will this form be downloaded?
Copy link to clipboard
Copied
It will be used on a PC or Laptop. Could be running Windows or MAC OS. most likely Windows
Find more inspiration, events, and resources on the new Adobe Community
Explore Now