Thanks! Event.stopPropogation() works for all my Validators, but for some reason not on a NumberValidator... Weird... But it's definitely better than it was this morning!
When I get more time I might set something more complicated up. Thanks heaps! -Josh On Fri, Mar 7, 2008 at 10:28 AM, Sherif Abdou <[EMAIL PROTECTED]> wrote: > this prob will help the event.stopPrapgation() stops it but u can see if > everything passed. this is something i am working on so feel free to use it > * > > package > * com.manager > > { > > *import* flash.utils.Dictionary; > > *import* mx.events.ValidationResultEvent; > > *import* mx.validators.Validator; > > *//so we dont have to put it we just assume* > > [ > *DefaultProperty*(*"validators"*)] > > *public* *class* ValidatorManager > > { > > /** > > * @private > > * Tells Us If Everything in the Form is Valid > > */ > > [ > *Bindable*] > > *public* *var* formValid:Boolean=*false*; > > /** > > * Accepts an Array of Validators which we will loop through > > * and make sure all of them pass > > */ > > [ > *ArrayElementType*(*"mx.validators.Validator"*)] > > *private* *var* $validators:Array; > > /** > > * @private > > * Key Used to retrieve the Component > > */ > > *private* *var* $validatorKey:Dictionary = *new* Dictionary(); > > *public* *function* ValidatorManager() > > { > > *super*(); > > } > > /** > > * Setters and Getters To get what the Validators are > > */ > > *public* *function* *get* validators():Array{ > > *return* $validators; > > } > > *public* *function* *set* validators(value:Array):*void*{ > > $validators=value; > > *for*(*var* i:int=0;i<$validators.length;i++){ > > Validator($validators[i]).addEventListener(ValidationResultEvent.INVALID > ,figureOutResults); > > Validator($validators[i]).addEventListener(ValidationResultEvent.VALID > ,figureOutResults); > > $validatorKey[$validators[i]] = > *new* Object(); > > $validatorKey[$validators[i]].target=$validators[i]; > > $validatorKey[$validators[i]].isValid= > *false*; > > } > > } > > /** > > * @private > > * Basically this function tells us if we can say that everything in > > * the form is valid > > */ > > *private* *function* figureOutResults(event:ValidationResultEvent):*void* > > { > > *//so we start off as a base of true, reason is we will need 2 trues for > us to have a true* > > *var* tmpFlag:Boolean=*true*; > > *for*(*var* i:int=0;i<$validators.length;i++) > > { > > *//check all of them* > > *if*($validatorKey[$validators[i]].target==event.currentTarget) > > { > > $validatorKey[$validators[i]].isValid=( > event.type==ValidationResultEvent.VALID); > > } > > *//get the previous value and put it against the other and see if we can > get a true* > > *//if not that means that one of the validators is invalid.* > > tmpFlag=(tmpFlag && $validatorKey[$validators[i]].isValid); > > } > > formValid=tmpFlag; > > */* > > THIS STOPS ANYTHING FROM SHOWING > > */ > * > > event.stopPropagation(); > > } > > } > > } > > > ----- Original Message ---- > From: Josh McDonald <[EMAIL PROTECTED]> > To: "flexcoders@yahoogroups.com" <flexcoders@yahoogroups.com> > Sent: Thursday, March 6, 2008 5:49:55 PM > Subject: [flexcoders] Can I check validation without validator.validate() > and the associated visual feedback? > > Hi guys, > > What I'm after is something that will simply give me a true/false result > for a mx:validator without triggering the popups or red outlines on fields. > Is there an easy way to do this? If not, should I write custom validators > with this functionality / use modified SDK source, or would it be easier to > extend the various validators and peek into protected structures? > > Please note that I don't want to disable the functionality of validate(), > I just want to be able to see whether or not it would pass. > > Thanks in advance, > -Josh > > -- > "Therefore, send not to know For whom the bell tolls, It tolls for thee." > > :: Josh 'G-Funk' McDonald > :: 0437 221 380 :: [EMAIL PROTECTED] com <[EMAIL PROTECTED]> > > > ------------------------------ > Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it > now.<http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ> > -- "Therefore, send not to know For whom the bell tolls, It tolls for thee." :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]