I have a static helper method I call that validates required field.

var text:TextInput= new TextInput();

if I run this twice:
validateRequired(text);
validateRequired(text);

My text.errorMessage = "This field is required\nThis field is required"

I noticed that we keep pushing errorMessage to the private 
errorObjectArray/errorArray in UIComponenet. What can I do to 'clear' the error 
state so that errorObjectArray gets flushed accordingly? setting errorString to 
nul/"" doesnt seem to help as it gets rebuild on the next validate(). Should I 
remove some eventListeners?

public static function validateRequired(control:UIComponent) : Boolean
{
        control.errorString = "";
        
        var reqFieldValidator:Validator = new Validator();
        reqFieldValidator.source = control;
        reqFieldValidator.required = true;
        reqFieldValidator.property = "text";
        reqFieldValidator.listener = control;

        return (reqFieldValidator.validate().type != 
ValidationResultEvent.VALID);
}

Reply via email to