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

Insert Current Date if blank, static if not blank

Community Beginner ,
Oct 11, 2019 Oct 11, 2019

I have a form that I want to place the current date in the date field when you open the form.  Once the form is saved and I open it two days later, I do not want to have the date field reset to the new current date.  I want it to stay static but allow me to manually change it if I want.  How to do this and where do I write it?

 

Thank you in advance.

473
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 ,
Oct 11, 2019 Oct 11, 2019

Place the date when the field is empty.

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 ,
Oct 11, 2019 Oct 11, 2019

Hi

 

Place this script as a document level Javascript

 

if (this.getField("DateField").value == null || this.getField("DateField").value == "") {
    this.getField("DateField").value = util.printd("yyyy-mm-dd", new Date());
}


Acrobate du PDF, InDesigner et Photoshopographe
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 ,
Oct 11, 2019 Oct 11, 2019
It still reverts to current date if I save it with a different date.
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 ,
Oct 11, 2019 Oct 11, 2019
LATEST
Nevermind....it works now....thank you so much.
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