Well the valueCommit event is meant to encompass more of those events so you don’t have to think about all the sub-events.  It wouldn’t capture the “change” event but often you don’t want to validate then anyway…

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Raheen M Shabbazz
Sent: Friday, August 04, 2006 9:11 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Validators -- Is there a better way of doing this? (Flex 2)

 

Still encountering this issue -- any ideas?

--- In [EMAIL PROTECTED]ups.com, "Raheen M Shabbazz"
<raheen_m_shabbazz@...> wrote:
>
> Hello All,
>
> I'm using Flex 2 to develop an app that requires some validation. I
> can't seem to find any info on how to reuse validators or how to use
> several trigger events within in a single validator.
>
> Below is a snippet of my code
>
> ----------------------
> <mx:NumberValidator source="{view.longitudeText}" property="text"
> minValue="-180" maxValue="180"
> trigger="{view.longitudeText}" triggerEvent="change" />
> <mx:NumberValidator source="{view.longitudeText}" property="text"
> minValue="-180" maxValue="180"
> valid="view.restSampleViewHelper.getMap()"
> trigger="{view.longitudeText}" triggerEvent="enter" />
> <mx:NumberValidator source="{view.longitudeText}" property="text"
> minValue="-180" maxValue="180"
> valid="view.restSampleViewHelper.getMap()"
> trigger="{view.longitudeText}" triggerEvent="focusOut" />
>
> <mx:NumberValidator source="{view.latitudeText}" property="text"
> minValue="-180" maxValue="180"
> trigger="{view.latitudeText}" triggerEvent="change" />
> <mx:NumberValidator source="{view.latitudeText}" property="text"
> minValue="-180" maxValue="180"
> valid="view.restSampleViewHelper.getMap()"
> trigger="{view.latitudeText}" triggerEvent="enter" />
> <mx:NumberValidator source="{view.latitudeText}" property="text"
> minValue="-180" maxValue="180"
> valid="view.restSampleViewHelper.getMap()"
> trigger="{view.latitudeText}" triggerEvent="focusOut" />
> ----------------------
>
> That's pretty ugly -- expecially considering that this is only 2 of my
> 20+ variables. Is there a better way? What am I missing?
>
> Thanks for your help!
>

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to