PDA

View Full Version : Default for datefield



ThierryC
08-04-2009, 10:05 AM
i have a form with a datefield
This is the definition :


items: [{xtype: 'datefield',
id: 'DftDate',
name: 'DftDate',
format: 'Y-m-d',
fieldLabel: 'Test default date',
value: Date()
}, ...

When showing the form i'd like to have the field already showing the current date as a default.
But with adding the parameter value: Date() , nothing changes and the form is still shown with a blank datefield.

what is the best way for achieving this.

richard.milone
08-04-2009, 11:29 AM
A date in JavaScript is an object so you should put a "new" in front of it like:

value: new Date()

Let me know if this works for you.

ThierryC
08-11-2009, 03:12 AM
Hi Richard,

yeah ... it works...

did'nt know that life could be so simple



thx

thierry