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

Auto populate future date

Explorer ,
Dec 17, 2024 Dec 17, 2024

This form is about to drive me insane.

 

I want the form to auto populate a date 30 days in the future from the current date when opened. How can I make this happen?

TOPICS
JavaScript
321
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 ,
Dec 17, 2024 Dec 17, 2024

Use something like this code as a doc-level script (NOT inside a function):

 

 

var d = new Date();
d.setDate(d.getDate()+30);
this.getField("FutureDate").value = util.printd("dd/mm/yyyy", d);

 

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
Explorer ,
Dec 18, 2024 Dec 18, 2024
LATEST

BLESS YOU

I was very close with my code, so I guess I must be learning something?

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