Validator, Model and Form controls : Form Validator « Components « Flex






Validator, Model and Form controls

Validator, Model and Form controls
     
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    
    <mx:Model id="infoVO">
        <infoVOistration>
            <email>{email.text}</email>
            <phone>{phone.text}</phone>
            <zip>{zip.text}</zip>
        </infoVOistration>
    </mx:Model>
    
    <mx:EmailValidator source="{infoVO}" property="email" trigger="{submit}" triggerEvent="click" listener="{email}"/>
    <mx:PhoneNumberValidator source="{infoVO}" property="phone" trigger="{submit}" triggerEvent="click" listener="{phone}"/>
    <mx:ZipCodeValidator source="{infoVO}" property="zip" trigger="{submit}" triggerEvent="click" listener="{zip}"/>
    
    <mx:Form>
        <mx:FormItem label="Email" required="true">
            <mx:TextInput id="email" width="200"/>
        </mx:FormItem>
        <mx:FormItem label="Phone" required="true">
            <mx:TextInput id="phone" width="200"/>
        </mx:FormItem>
        <mx:FormItem label="Zip" required="true">
            <mx:TextInput id="zip" width="60"/>
        </mx:FormItem>
        <mx:FormItem>

            <mx:Button id="submit" label="Validate"/>
        </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.Using Validators.validateAll() method to validate a formUsing Validators.validateAll() method to validate a form
5.Validating form control contents data on user entryValidating form control contents data on user entry
6.Validate form data with ActionScriptValidate form data with ActionScript
7.Validating user input for form dataValidating user input for form data
8.Change form input box label when data is not validChange form input box label when data is not valid
9.Use ActionScript to validate form dataUse ActionScript to validate form data
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