Thanks for the ideas. I'm a little surprised that there's no notion of cancelling a change event or capturing some kind of "before change" event.
Jeremy --- In [email protected], "Joan Lafferty" <[EMAIL PROTECTED]> wrote: > > Here is a quick example of how you can do it. > > > > <?xml version="1.0" encoding="utf-8"?> > > > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > > > > > <mx:Script> > > <![CDATA[ > > import mx.controls.Alert; > > import mx.events.CloseEvent; > > import mx.events.CalendarLayoutChangeEvent; > > > > private var currentSetDate:Date; > > private var newDateChosen:Date; > > private function > confirm(event:CalendarLayoutChangeEvent):void > > { > > newDateChosen = event.newDate; > > Alert.show("Are you sure you want to select " + > event.newDate + "?", "Confirm Changes", 3, this, alertClickHandler); > > } > > > > > > private function alertClickHandler(event:CloseEvent):void > > { > > if (event.detail==Alert.YES) > > { df.selectedDate = newDateChosen; > > currentSetDate = newDateChosen; > > } > > else > > { > > df.selectedDate = currentSetDate; > > } > > } > > ]]> > > </mx:Script> > > > > > > <mx:DateField id="df" change="confirm(event)" > creationComplete="currentSetDate = df.selectedDate" /> > > > > </mx:Application> > > > > Good luck. > > Joan > > > > ________________________________ > > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of Karl Johnson > Sent: Wednesday, August 02, 2006 1:19 PM > To: [email protected] > Subject: RE: [flexcoders] need to be able to cancel change to a > DateField > > > > You might be able to find another event to capture before the commit, > but it can be a bit hacky sometimes because of the different way to > interact with form inputs fire different events. The way to do this that > would ensure you get it right everytime is to store the dateField value > in a variable, and if they don't confirm the change, change the > selectedDate back to what was in the Date variable. If they do confirm, > then set the variable equal to the new selectedDate. > > > > If you are doing this in a lot of places, then simply extend the > DateField and add a new property on it called previousDate or something > like that. Then you could build the confirmation and change back logic > right into the component. > > > > Karl > > > > Cynergy Systems, Inc. > > > > ________________________________ > > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of jrjazzman23 > Sent: Wednesday, August 02, 2006 3:22 PM > To: [email protected] > Subject: [flexcoders] need to be able to cancel change to a DateField > > I'd like to be able to ask the user to confirm their date selection > BEFORE the selectedDate field gets set. The Change event appears to > not be cancelable. Is there any other way to accomplish this? > > thanks > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

