[flexcoders] Re: Form validation before submitting...

2009-05-19 Thread Tim Hoff
Just one technique: using AS, throw the validators into an ArrayCollection on creationComplete. Before you submit, loop through the validators and execute the validate() function on each. If one fails, bail out. The docs can show you how to work with ValidationResultEvent. Also remember

[flexcoders] Re: Form validation before submitting...

2009-05-18 Thread sminrana
first you trying to use numChildren as a method but it is not it is a property which return int value and it is read-only so remove the () in the loop second what is errorString ???

[flexcoders] Re: Form validation before submitting...

2009-05-18 Thread Tim Hoff
import mx.core.UIComponent; private function formIsValid():Boolean { var validForm:Boolean = true; for (var i:int = 0; i this.numChildren; i++) { if ( UIComponent(this.getChildAt(i)).errorString != ) { validForm = false; }

Re: [flexcoders] Re: Form validation before submitting...

2009-05-18 Thread Laurence MacNeill
At 04:24 PM 5/18/2009, you wrote: first you trying to use numChildren as a method but it is not it is a property which return int value and it is read-only so remove the () in the loop second what is errorString ??? Oh LOL -- now I feel like an idiot. Of course, it's a property not a

Re: [flexcoders] Re: Form validation before submitting...

2009-05-18 Thread Laurence MacNeill
At 04:54 PM 5/18/2009, you wrote: import mx.core.UIComponent; private function formIsValid():Boolean { var validForm:Boolean = true; for (var i:int = 0; i this.numChildren; i++) { if ( UIComponent(this.getChildAt(i)).errorString != ) {

Re: [flexcoders] Re: Form validation before submitting...

2009-05-18 Thread Ivan Perez
Why not stop and return when validForm just turns false, like this: On Mon, May 18, 2009 at 5:54 PM, Tim Hoff timh...@aol.com wrote: * import * mx.core.UIComponent; *private* *function* formIsValid():Boolean { * for* (*var* i:int = 0; i *this*.numChildren; i++) { *

[flexcoders] Re: Form validation before submitting...

2009-05-18 Thread Tim Hoff
Yep, good re-factor. -TH --- In flexcoders@yahoogroups.com, Ivan Perez manope...@... wrote: Why not stop and return when validForm just turns false, like this: On Mon, May 18, 2009 at 5:54 PM, Tim Hoff timh...@... wrote: * import * mx.core.UIComponent; *private* *function*

Re: [flexcoders] Re: Form validation before submitting...

2009-05-18 Thread Laurence MacNeill
At 05:13 PM 5/18/2009, you wrote: Why not stop and return when validForm just turns false, like this: On Mon, May 18, 2009 at 5:54 PM, Tim Hoff mailto:timh...@aol.comtimh...@aol.com wrote: import mx.core.UIComponent; private function formIsValid():Boolean { for (var i:int = 0; i

[flexcoders] Re: Form validation before submitting...

2009-05-18 Thread Tim Hoff
Are you sure that you are looking for the children in the correct parent? Worked for me. -TH --- In flexcoders@yahoogroups.com, Laurence MacNeill lmacne...@... wrote: At 05:13 PM 5/18/2009, you wrote: Why not stop and return when validForm just turns false, like this: On Mon, May 18,

Re: [flexcoders] Re: Form validation before submitting...

2009-05-18 Thread Laurence MacNeill
At 07:56 PM 5/18/2009, you wrote: Are you sure that you are looking for the children in the correct parent? Worked for me. -TH Ahh -- that's probably it. All the textInputs I'm looking for are in a Form. Which makes them children of the Form? Or children of each FormItem tag? How would

[flexcoders] Re: Form validation before submitting...

2009-05-18 Thread Tim Hoff
Almost seems like you'd want to loop through the validators instead, huh? -TH --- In flexcoders@yahoogroups.com, Laurence MacNeill lmacne...@... wrote: At 07:56 PM 5/18/2009, you wrote: Are you sure that you are looking for the children in the correct parent? Worked for me. -TH Ahh

Re: [flexcoders] Re: Form validation before submitting...

2009-05-18 Thread Laurence MacNeill
At 08:13 PM 5/18/2009, you wrote: Almost seems like you'd want to loop through the validators instead, huh? -TH Didn't know I could do that... How would I go about doing that? Thanks, Laurence MacNeill Mableton, Georgia, USA