Validating form control contents data on user entry : Form Validator « Components « Flex






Validating form control contents data on user entry

Validating form control contents data on user entry
           

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        
        private function processValues():void {
            var inputZip:String = zipCode.text;
            var inputPhone:String = phoneNumber.text;
        }
      
    </mx:Script>
    <mx:ZipCodeValidator id="zcVal" source="{zipCode}" property="text" domain="US or Canada" />
    <mx:PhoneNumberValidator id="pnVal" source="{phoneNumber}" property="text" />
    <mx:Form id="myForm" defaultButton="{mySubmitButton}">
        <mx:FormItem label="Zip Code">
            <mx:TextInput id="zipCode" />
        </mx:FormItem>
        <mx:FormItem label="Phone Number">
            <mx:TextInput id="phoneNumber" />
        </mx:FormItem>
        <mx:FormItem>
            <mx:Button label="Submit" id="mySubmitButton" click="processValues();" />
        </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.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