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

Inserting an auto-populate date that is a year from another auto-populated date

New Here ,
Jun 23, 2021 Jun 23, 2021

I inserted a field that has today's date auto-populate. I want to create another field that will auto-populate a date that is the same month and day but the year will be the NEXT year.

 

Using today as an example:

Here is the auto-populated field for today's date

CourtGinger_0-1624485623543.png

And this is what it's called: 

CourtGinger_1-1624485665027.png

I need a field that will populate the date to Jun 23, 2022 automatically (based off the other date).

Hope that made sense.

 

Is this possible? 

TOPICS
Edit and convert PDFs , General troubleshooting , JavaScript , PDF forms
6.4K
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 ,
Jun 24, 2021 Jun 24, 2021

A better solution is to use the built-in methods of the Date object to do it, which will take care of the Feb 29th issue without having to hard-code each leap year into it:

 

var sDate = this.getField("Cur_Date").valueAsString;
if (sDate) {
	var cDate = util.scand("mmm dd, yyyy", sDate);
	cDate.setFullYear(cDate.getFullYear()+1);
	event.value = util.printd("mmm dd, yyyy", cDate);
} else event.value = "";

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 ,
Jul 07, 2021 Jul 07, 2021

Most (maybe all) scripts will stop working when the file is converted to Adobe Sign.

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
New Here ,
Jul 08, 2021 Jul 08, 2021

Oh good to know, thank you.

 

Is there any way around that?

 

The script that autopopulates today's date seems to work. It's weird that the other one doesn't

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 ,
Jul 08, 2021 Jul 08, 2021

> Is there any way around that?

 

Don't use Adobe Sign.

Or use only features supported by Adobe Sign.

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
New Here ,
Jul 08, 2021 Jul 08, 2021
LATEST

Ok thank you

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