Validate Email With ActionScript : EmailValidator « Data Model « Flex






Validate Email With ActionScript

Validate Email With ActionScript
          
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="150">
  <mx:Script>
    
      import mx.events.ValidationResultEvent;
      import mx.validators.EmailValidator;
                        
      private var isValid:Boolean;
      public var emailValidator:EmailValidator = new EmailValidator();
      public var validator:ValidationResultEvent;

      public function validate():void {
        emailValidator.source = email;

        emailValidator.property = "text";

        validator = emailValidator.validate();
 
      }
  
  </mx:Script>
  <mx:Panel title="Validate with ActionScript" width="210" height="75">
    <mx:HBox width="100%" height="100%" paddingLeft="3" paddingTop="3">
      <mx:TextInput id="email" width="100"/>
      <mx:Button label="Validate" click="validate()" />
    </mx:HBox>
  </mx:Panel>
</mx:Application>

   
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Using ActionScript to validate EmailUsing ActionScript to validate Email
2.Email address validationEmail address validation
3.Using a submit button to validate form fieldsUsing a submit button to validate form fields
4.Use EmailValidator to validate email cell editorUse EmailValidator to validate email cell editor
5.Data source for EmailValidatorData source for EmailValidator
6.Using the EmailValidator classUsing the EmailValidator class
7.Using EmailValidatorUsing EmailValidator
8.Use new line character to error messageUse new line character to error message