TextInput invalid and valid event : TextInput Validation « Components « Flex






TextInput invalid and valid event

TextInput invalid and valid event
          


<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
  <mx:Script>
    
    import flash.events.Event;
    
    private var currentTextColor:Object;
    private function myCreationComplete(eventObj:Event):void {
      currentTextColor = getStyle('color');
    }
    private function handleInvalidVal(eventObject:Event):void {
      setStyle('color', "red");
    }
    private function handleValidVal(eventObject:Event):void {
      setStyle('color', currentTextColor);
    }
    
  </mx:Script>
  <mx:PhoneNumberValidator source="{phoneInput}" property="text" />
  <mx:TextInput id="phoneInput"
    initialize="myCreationComplete(event);"
    invalid="handleInvalidVal(event);" valid="handleValidVal(event);" />
  <mx:TextInput id="zipInput" />
</mx:Application>

   
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Using the DateValidator to validate a single source inputUsing the DateValidator to validate a single source input
2.Use validator for TextInput fieldsUse validator for TextInput fields
3.Validate a form made up of several TextInput controlsValidate a form made up of several TextInput controls