Validating user input for form data : Form Validator « Components « Flex

Home
Flex
1.Chart
2.Components
3.Container
4.Data Model
5.Development
6.Effects
7.Event
8.Graphics
9.Grid
10.Style
Flex » Components » Form ValidatorScreenshots 
Validating user input for form data
Validating user input for form data
           

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
  <mx:Script>
    
      import mx.events.ValidationResultEvent;

      private function invalidHandler(event:ValidationResultEvent):void {
        usernameItem.setStyle("color"0xFF0000);
        usernameItem.label = "-=Name=-";
      }

      private function validHandler(event:ValidationResultEvent):void {
        usernameItem.setStyle("color"0x000000);
        usernameItem.label = "Name";
     }

  
  </mx:Script>

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

  <mx:Validator id="validator" source="{username}" property="text" invalid="invalidHandler(event)" valid="validHandler(event)" listener="{null}" />

</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.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
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.