Use ActionScript to validate form data : Form Validator « Components « Flex






Use ActionScript to validate form data

Use ActionScript to validate form data
           
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="initializeHandler(event)">
  <mx:Script>
    
      import mx.validators.Validator;

      private var _validator:Validator;

      private function initializeHandler(event:Event):void {
        _validator = new Validator( );
        _validator.source = username;
        _validator.property = "text";
      }

  
  </mx:Script>
  <mx:Form>
    <mx:FormHeading label="Sample Form"/>
    <mx:FormItem label="Name">
      <mx:TextInput id="username"/>
    </mx:FormItem>
    <mx:FormItem>
      <mx:Button id="button" label="Submit"/>
    </mx:FormItem>
  </mx:Form>

</mx:Application>

   
    
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Using Flex validators with form modelsUsing Flex validators with form models
2.Set up validator for Form input fieldsSet up validator for Form input fields
3.Use Validator to validate data from a formUse Validator to validate data from a form
4.Validator, Model and Form controlsValidator, Model and Form controls
5.Using Validators.validateAll() method to validate a formUsing Validators.validateAll() method to validate a form
6.Validating form control contents data on user entryValidating form control contents data on user entry
7.Validate form data with ActionScriptValidate form data with ActionScript
8.Validating user input for form dataValidating user input for form data
9.Change form input box label when data is not validChange form input box label when data is not valid
10.Validate a date entered into a formValidate a date entered into a form
11.Validate an e-mail address to ensure that it is formatted correctlyValidate an e-mail address to ensure that it is formatted correctly