ok - got it. 

I chained the change() with a doLater() call. The function called by
doLater() sets the selectedDate to the default date again. 

Works like a charm. Now the DateField always shows a date, the user
cannot de-select it by clicking on the selection again

Dirk.

> -----Original Message-----
> From: Dirk Eismann 
> Sent: Wednesday, May 12, 2004 4:27 PM
> To: [email protected]
> Subject: RE: [flexcoders] DateField behavior
> 
> 
> ok, I can life with it if that's the intended behavior. But here's
> another problem: in my special case, a date *has* to be 
> chosen (the user
> may not deselect a date).
> 
> I thought I could use the DateField.change() event for validation. If
> the selectedDate is undefined I simply set a default date:
> 
> <!-- mxml snippet -->
> <mx:DateField change="checkDate(event)" />
> 
> // AS snippet
> function checkDate(evt:Object):Void {
> if (evt.target.selectedDate == undefined) {
> // the user selected no date or 
> // clicked the selected date again
> evt.target.selectedDate = new Date(2004, 4, 14);
> }
> }
> 
> This does work to a certain degree: the selectedDate gets set
> programmatically and the calendar does show the new selection when
> re-opening it, *but* the field still remains empty.
> 
> Dirk.
> 


Reply via email to