tags:

views:

321

answers:

2

I' m trying to use the DateField control. I can set the current value using the selectedDate field.

Adobe says: "Selecting the currently selected date in the control deselects it, sets the selectedDate property to null", so when user selects other date the selectedDate = null. How do I can get the current selected value? I only saw in the debugger that DateField's text property contains the string with selected date? Do I need to parse it back?

10x in advance yevgeny

A: 

You can do:

<mx:DateField selectedDate="{new Date()}"/>

this will give you today's date as selected date or you can do:

<mx:DateField selectedDate="{new Date(2010, 5, 7)}"/>

This will select the date 7th of June 2010

Month inputted is always -1 of the month you write: so december is 11, january is 0 and so on

Ladislav

Ladislav
+1  A: 

I think I found the problem. I was trying to format the date like: http://flexonblog.wordpress.com/2009/05/05/tip-on-formatting-dates-with-the-datefield-control-in-flex/ but I only implemented the label function and not the parse function and this caused the problem. When I implemented both everything became okay

Yevgeny