tags:

views:

1382

answers:

1

I've created a DateTextBox like:

When the page loads there is no value in the field. I would like the value to default to today. Is there a way to handle this? I know I could use the "value" attribute and set it in the declaration, but that only allows me to put a static date in the field, not a dynamic date.

It would also be good if the solution works with a form reset too.

Thanks for the help!

+2  A: 

The parser supports the "now" keyword, so you could do:

<input dojoType=dijit.form.DateTextBox value="now">

Of course, for programmatic creation you would simply do:

new dijit.form.DateTextBox({value: new Date()})
Bill Keese