[flexcoders] Check for all validation errors

2007-04-24 Thread Larry Gutman

I have a 7x8 grid of custom textinputs. I have set the validation
information in the custom component. I want to check all of the
textinputs to see if any of them have validation errors. I would like to
keep the form from submitting until the errors are cleaned up. I would
also like to have a list of all the error messages active at this time.
Any help or direction would be helpful.



Thanks



Larry





RE: [flexcoders] Check for all validation errors

2007-04-24 Thread Kenneth Sutherland
There is a way of checking multiple fields at once, follow the link

http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.
htm?context=LiveDocs_Partsfile=1773.html
http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp
.htm?context=LiveDocs_Partsfile=1773.html 

but as I've said in a previous post it has a flaw or at least I can't
get it to work as I'd like it to :-)

So if the above is of no use then you'll need a single validator for
each input. To do so, try the following.

 

public function isValid():Boolean{

 

var validators : Array = [  firstValidator, secondValidator,
thirdValidator ];

 


if(
Validator.validateAll(validators).length == 0 ){

//everything is good

return true;

} else {

return false;

}

}

 

Validator.validateAll returns an Array containing one
ValidationResultEvent object for each validator that failed. Returns an
empty Array if all validators succeed.

 

If any of the validators fails then the function will return false and
you don't submit the form.

 

Kenneth.

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Larry Gutman
Sent: 24 April 2007 14:14
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Check for all validation errors

 

I have a 7x8 grid of custom textinputs. I have set the validation
information in the custom component. I want to check all of the
textinputs to see if any of them have validation errors. I would like to
keep the form from submitting until the errors are cleaned up. I would
also like to have a list of all the error messages active at this time.
Any help or direction would be helpful.

 

Thanks

 

Larry