Hi

I am trying to set number validator for many textInputs present in one
form. I am unable to do so.


My code is:

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

        <mx:Script>
                <![CDATA[
                        import mx.events.ValidationResultEvent;
                        import mx.events.ListEvent;
                        import mx.controls.Alert;
                        import mx.validators.NumberValidator;

                        public var myValidator:NumberValidator;

                        public function validateText(event:FocusEvent):void{
                                myValidator= new NumberValidator();
                                myValidator.source = event.currentTarget;
                                myValidator.required = true;
                                myValidator.allowNegative = false;
                                myValidator.property = "text";
                                myValidator.requiredFieldError = "This field is 
required";
                                myValidator.precision = 2;
                                myValidator.precisionError = "Invalid 
Precision";

                        }

                ]]>
        </mx:Script>

        <mx:VBox width="452">
        <mx:HBox>
                <mx:Label text="hii"/>
                <mx:TextInput id="a" width="100" focusOut="validateText(event);"
restrict="012345678910 ."/>
        </mx:HBox>
        <mx:HBox>
                <mx:Label text="hii"/>
                <mx:TextInput id="b" width="100" 
focusOut="validateText(event);"/>
        </mx:HBox>
        <mx:HBox>
                <mx:Label text="hii"/>
                <mx:TextInput id="c" width="100" 
focusOut="validateText(event);"/>
        </mx:HBox>



        </mx:VBox>
</mx:Application>

Its not working on tabbing as well as on normal mouse action.

Please help me............sam
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to