Today's date as default date | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

7 replies

June 21, 2010

If you look in the Custom LIbrary there is a Current Date object. Just dragh that onto your form and it will populate with today's date when you render the form.

Paul

Level 2
June 21, 2010

I don't see what you are talking about.  I only have a date/hour field that I can drag to the form, but nothing concerning Current Date?

Also, I would like a field that shows today's date as a default value, but that the user can change if he wants to...

Thanks for your help!

Dave

June 21, 2010

I have included a screen shot .....

Paul

Level 2
June 21, 2010

Thanks for the screen shot, I had forgotten about the custom objects!

Is there a way that I can have this default date, but that the user can change it?  In the object panel of my date/hour field, there is a place where I can enter a default value.  Is there some kind of script I can enter that will make today's date the default value instead of a precise date?

Thanks again!

June 21, 2010

Instead I would suggest that you use code on the Doc Ready event to do this:

if

(this.rawValue == null) then

     $.rawValue

= num2date(date(), DateFmt(1))

endif

Remember that this is FormCalc code so set the language in the script editor accordingly. The if condition is used so that if you save the form and open it again the values are not over written with the current date.

Hope that helps

Paul

Level 2
June 21, 2010

I just realized that with the ES 2 version of LCD, it's fairly easy to do this with the Action Builder!

Thank you very much for your help!

December 2, 2015

Unbelievable - another idiot that doesn't read the question and jumps straight in with the wrong answer. The question is 'set today's date as the DEFAULT date' idiot - not the committed date.