Add 60 Days from input Date field into another field

Community Beginner ,
Mar 11, 2021 Mar 11, 2021

Copy link to clipboard

Copied

I am very much a novice when it comes to script.

 

However, I have this Date picker field, called "Issue Date". and I want it to calculate +60 days from the date selected in the Issue Date field and input it in another field called "Expiration Date"

 

Please explain to me how I can do that?  Where do I put in the code and what the code should be?

 

Thank you!

 

Drew

TOPICS
Edit and convert PDFs, How to, JavaScript, PDF forms

Views

70

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
community guidelines

correct answers 1 Correct Answer

Adobe Community Professional , Mar 11, 2021 Mar 11, 2021
As "Validation script" of "Issue Date" field use this:if(event.value == "") this.getField("Expiration Date").value = ""; else{ var days = util.scand("dd-mmm-yyyy", event.value) days.setDate(days.getDate() +60); this.getField("Expiration Date").value = util.printd("dd-mmm-yyyy", days);} Change date format from "dd-mmm-yyyy" to something else if you wish.

Likes

Translate

Translate
Adobe Community Professional ,
Mar 11, 2021 Mar 11, 2021

Copy link to clipboard

Copied

As "Validation script" of "Issue Date" field use this:

if(event.value == "")
this.getField("Expiration Date").value = "";
else{
var days = util.scand("dd-mmm-yyyy", event.value)
days.setDate(days.getDate() +60);
this.getField("Expiration Date").value = util.printd("dd-mmm-yyyy", days);}

 

 

Change date format from "dd-mmm-yyyy" to something else if you wish.

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
community guidelines
Community Beginner ,
Mar 11, 2021 Mar 11, 2021

Copy link to clipboard

Copied

LATEST

wow!  This is perfect!

 

Thank you so much!!  This is a huge help to the project I was working 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
community guidelines