Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Add 60 Days from input Date field into another field

Community Beginner ,
Mar 11, 2021 Mar 11, 2021

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
1.3K
Translate
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
1 ACCEPTED SOLUTION
Community Expert ,
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.

View solution in original post

Translate
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 Expert ,
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.

Translate
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
LATEST

wow!  This is perfect!

 

Thank you so much!!  This is a huge help to the project I was working on!! 

 

 

Translate
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