Hi Neelima,

Try this code:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="vertical">
    <mx:Script>
        <![CDATA[
            [Bindable] private var regExpStr:String = "\\d{3,5}";
            [Bindable] private var isValid:Boolean;

        ]]>
    </mx:Script>
    <mx:TextInput id="myNum" restrict="0-9" maxChars="5"/>
    <mx:RegExpValidator id="myReg" flags="g" source="{myNum}"
property="text" trigger="{myNum}" triggerEvent="change"
        expression="{regExpStr}" valid="{isValid=true}"
invalid="{isValid=false}"/>
    <mx:Label id="Status" text="{isValid}"/>
</mx:Application>


Regards,
Venkat
www.venkatv.com


On Sat, Feb 14, 2009 at 5:04 PM, HISSAM <[email protected]> wrote:

> use this restrict
>
>   <mx:TextInput id="textBox" restrict="0-9" />
>
> On Fri, Feb 13, 2009 at 11:41 AM, Neelima Kakarla <
> [email protected]> wrote:
>
>> hai varun
>>
>>      Your code works for stingvalidator because there is a property called
>> minLength and maxLength.
>>      But i need the code for numericValidator which should allow minimum
>> of 3 digits and maimum of 5 digits.
>>      Could you please forward for this requirement.
>>
>> Bye
>>
>>
>> On Thu, Feb 12, 2009 at 7:30 PM, vrathore <[email protected]> wrote:
>>
>>>
>>> Hello,
>>>
>>> Here is the code sniplet
>>>
>>> public function Save():void
>>> {
>>>
>>>                        var vResult:ValidationResultEvent;
>>>
>>>                        vResult = textValidator.validate();
>>>                        if(vResult.type != ValidationResultEvent.VALID)
>>>                        {
>>>                                setValidationFocus(textBox);
>>>                                return;
>>>                        }
>>> }
>>>
>>> private function setValidationFocus(formObject:Object):void
>>> {
>>>        Alert.show("Please correct the error(s) in the highlighted box.");
>>>        formObject.setFocus();
>>>        formObject.dispatchEvent(new MouseEvent(MouseEvent.MOUSE_OVER));
>>> }
>>>
>>>        <mx:TextInput id="textBox" />
>>>        <mx:StringValidator id="textValidator" source="{textBox}"
>>> minLength="5" maxLength="3" required="true"  />
>>>
>>>
>>> Cheers
>>>
>>> Varun Rathore
>>>
>>>
>>
>>
>>
>
>
> --
> -----------------------------
> Regards,
>  HISSAM,
> ------------------------------
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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