How to Auto-Populate Today's Date in Date Field
Permalink Browser Info Environment
This may be second nature to many, but I'm having difficulty trying to get the Date field on an Advanced Form to automatically enter the current day's date when the form is displayed. It does include a drop-down calendar if anyone wants to make a change, but that's not even necessary, since the Date simply notes the date of data submission.
There is a "Default Value" field in the form setup (see image attached), but no examples or instruction in the documentation, and nothing I put in seems to work. Any help greatly appreciated.
There is a "Default Value" field in the form setup (see image attached), but no examples or instruction in the documentation, and nothing I put in seems to work. Any help greatly appreciated.
Type: | Discussion |
---|---|
Status: | In Progress |
I'm in the same boat here :-) If anyone can lend a hand?
Looking to do the same thing, need default date to be todays date.
Frank
Frank
I was able to achieve this by adding a HTML block before the advanced form block with the following code
Note the line
is assembling in european day month year sequence. You also have to change sem-field-107 to match the id of the date field in your particular form.
Note the line
today = (today.getDate()+1)+"/"+(today.getMonth()+1)+"/"+today.getFullYear();
is assembling in european day month year sequence. You also have to change sem-field-107 to match the id of the date field in your particular form.