Re: [flexcoders] How to DataBind to DateField when Null Values come into play??
Mike: What is the type of the property you are trying to bind to in your Value Object? A DateField selectedDate property can be sent to null and should give you an empty date. I've extended the DateField making my own DateField Component - EditDateField and I always use that whenever I use Date. My Component looks like this: mx:DateField xmlns:mx=http://www.adobe.com/2006/mxml; focusOut=checkFilterDate(); editable=true mx:Script ![CDATA[ *import* com.myDomain.util.DateValidate; *public* *var* defaultDate:Date; *private* *function* checkFilterDate():*void * { *if* (*this*.text.length == 0) { *this*.selectedDate = *null*; } *else* *if* (!DateValidate.validate(*this*.text)) { *this*.selectedDate = defaultDate; } *else * { *this*.selectedDate = DateValidate.format(*this*.text); } } ]] /mx:Script /mx:DateField Where my DateValidate class is some custom functions I've written that allow formats like mmddyy or mmdd to be input and automatically cast to a Date type. Hope this helps Sam On 19 Mar 2007 12:06:30 -0700, Mike Anderson [EMAIL PROTECTED] wrote: Hello All, What is the proper way to bind Data to a DateField? I ask this, because I get an error when I bind a Variable contained within a ValueObject (which contains a Null Value), to a DateField Control. Is it safe to say, that this DateField doesn't act like a TextField? Do I require a regular Variable cast as a Date to serve as a go-between, when transferring the ValueObject data to the DateField? I hope I am properly asking this question :) Thanks in advance for your help, Mike
[flexcoders] How to DataBind to DateField when Null Values come into play??
Hello All, What is the proper way to bind Data to a DateField? I ask this, because I get an error when I bind a Variable contained within a ValueObject (which contains a Null Value), to a DateField Control. Is it safe to say, that this DateField doesn't act like a TextField? Do I require a regular Variable cast as a Date to serve as a go-between, when transferring the ValueObject data to the DateField? I hope I am properly asking this question :) Thanks in advance for your help, Mike
RE: [flexcoders] How to DataBind to DateField when Null Values come into play??
Perhaps a ternary conditional? {(myDateProperty) ? myDateProperty : someDefaultDate} Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mike Anderson Sent: Monday, March 19, 2007 3:06 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] How to DataBind to DateField when Null Values come into play?? Hello All, What is the proper way to bind Data to a DateField? I ask this, because I get an error when I bind a Variable contained within a ValueObject (which contains a Null Value), to a DateField Control. Is it safe to say, that this DateField doesn't act like a TextField? Do I require a regular Variable cast as a Date to serve as a go-between, when transferring the ValueObject data to the DateField? I hope I am properly asking this question :) Thanks in advance for your help, Mike