Auto Updating Date field script - Needs to udate date first time opened not each time

Mar 01, 2018

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.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

102

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Auto Updating Date field script - Needs to udate date first time opened not each time

Mar 01, 2018

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.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

103

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 01, 2018 0
Mar 01, 2018

Copy link to clipboard

Copied

Use this code:

if (this.getField("Date").valueAsString=="") this.getField("Date").value = util.printd("dd-mmm-yyyy", new Date());

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 01, 2018 0
Mar 01, 2018

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 01, 2018 0
Mar 01, 2018

Copy link to clipboard

Copied

Just reset the form and then save it before uploading it to the server.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 01, 2018 0
Mar 02, 2018

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 02, 2018 0
try67 LATEST
Mar 02, 2018

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 02, 2018 0
Mar 01, 2018

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 01, 2018 0
Mar 01, 2018

Copy link to clipboard

Copied

On what kind of devices will this form be downloaded?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 01, 2018 0
Mar 01, 2018

Copy link to clipboard

Copied

It will be used on a PC or Laptop. Could be running Windows or MAC OS. most likely Windows

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 01, 2018 0