Components Flex



  
    
      import mx.controls.Alert;
      import mx.events.ValidationResultEvent;
      private var validator:ValidationResultEvent;
            
      private function validate():void{
        var isValid:Boolean=true;
        if(!this.validateDataModel()){
          isValid=false;
        }
        Alert.show("Results = "+isValid,"Validation");
      }
      private function validateDataModel():Boolean{
        var isValid:Boolean = true;
        validator = fNameValidator.validate();
        if(validator.type == ValidationResultEvent.INVALID){
          isValid = false;
        }
        validator = addressValidator.validate();
        if(validator.type == ValidationResultEvent.INVALID){
          isValid = false;
        }
        validator = cityValidator.validate();
        if(validator.type == ValidationResultEvent.INVALID){
          isValid = false;
        }
        validator = stateValidator.validate();
        if(validator.type == ValidationResultEvent.INVALID){
          isValid = false;
        }
        validator = zipValidator.validate();
        if(validator.type == ValidationResultEvent.INVALID){
          isValid = false;
        }
        validator = emailValidator.validate();
        if(validator.type == ValidationResultEvent.INVALID){
          isValid = false;
        }
        validator = phoneValidator.validate();
        if(validator.type == ValidationResultEvent.INVALID){
          isValid = false;
        }  
        return isValid;    
      }
  
  

  
    
      {fnametxt.text}
      
{addresstxt.text}

      {citytxt.text}
      {statetxt.text}
      {ziptxt.text}
      {phonetxt.text}
      {emailtxt.text}