Here is the custom component that I made. I added validation to it for simplicity. Should I ID all the validators and store them somewhere for easy access later?
{ import mx.controls.TextInput; import mx.validators.NumberValidator; import mx.events.FlexEvent; public class HourTextInput extends TextInput { public function HourTextInput() { addEventListener(FlexEvent.INITIALIZE, initializeHandler); } private function initializeHandler(event:FlexEvent):void { // Display the component paint(); } private function paint():void { var hourValidator:NumberValidator; hourValidator = new NumberValidator(); hourValidator.allowNegative=false; hourValidator.maxValue = 24; hourValidator.precision = 1; hourValidator.property= "text"; hourValidator.source = this; hourValidator.precisionError = "You can only enter hours to the tenth of an hour"; hourValidator.required = false; } } } --- In flexcoders@yahoogroups.com, "Kenneth Sutherland" <[EMAIL PROTECTED]> wrote: > > 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_Parts&file=00001773.html > <http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp > .htm?context=LiveDocs_Parts&file=00001773.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 >