Skip navigation
Currently Being Moderated

Flex Mobile textinput

Sep 18, 2012 4:24 AM

Hi, I type from Brazil,

Please I need example textinput with mask for Flex Mobile,


Thank's

 
Replies
  • Currently Being Moderated
    Sep 19, 2012 10:15 PM   in reply to marciofermino

    TextInput is already available for Flex Mobile.

    Not sure if that is what you wanted to ask?

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 30, 2012 3:00 AM   in reply to marciofermino

    Are you talking about validators?

    eg: Phone Number validator.

     

    Also, you can combine Formatter with Validator to get exact format in your textinput.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 30, 2012 9:26 PM   in reply to marciofermino

    I created a sample application.Check if this can help you.

     

    <?xml version="1.0" encoding="utf-8"?>

    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                                     xmlns:s="library://ns.adobe.com/flex/spark"

                                     xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">

              <s:layout>

                        <s:VerticalLayout/>

              </s:layout>

     

     

              <fx:Script>

                        <![CDATA[

                                  import mx.events.ValidationResultEvent;

     

                                  private var validResult:ValidationResultEvent;

     

                                  protected function button1_clickHandler(event:MouseEvent):void

                                  {

                                            validResult= phValidator.validate();

                                            if (validResult.type == ValidationResultEvent.VALID)

                                            {

                                                      readyNum.text=phFormatter.format(phNum.text) ;

                                            }

                                            else

                                                      readyNum.text="";

                                  }

     

                        ]]>

              </fx:Script>

              <fx:Declarations>

                        <mx:PhoneFormatter id="phFormatter" formatString="(###) ###-####" validPatternChars="#-() "/>

                        <mx:PhoneNumberValidator id="phValidator" property="text" source="{phNum}"  allowedFormatChars=""/>

              </fx:Declarations>

     

              <mx:Form>

                        <mx:FormItem label="Enter 10-digit Phone Number:">

                                  <s:TextInput id="phNum" text="" width="100%"/>

                        </mx:FormItem>

                        <mx:FormItem label="Your Formatted Phone Number: ">

                                  <s:TextInput id="readyNum" text="" width="100%" editable="false"/>

                        </mx:FormItem>

                        <mx:FormItem>

                                  <s:Button label="Validate and Format" click="button1_clickHandler(event)"/>

                        </mx:FormItem>

              </mx:Form>

     

     

    </s:Application>

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 31, 2012 8:23 PM   in reply to marciofermino

    you can apply the following handler on Change event of textinput phNum :

     

    protected function phNum_changeHandler(event:TextOperationEvent):void

                                  {

                                            if(phNum.text.length >=10)

                                            {

                                                      validResult= phValidator.validate();

                                                      if (validResult.type == ValidationResultEvent.VALID)

                                                      {

                                                                phNum.text=phFormatter.format(phNum.text);

                                                      }

                                                      else

                                                                readyNum.text="";

                                            }

                                            else

                                                      readyNum.text= "";

                                  }

     

    But then,after runtime format on the same textinput, it would be giving error message saying 'invalid characters in textinput' because of the round brackets.

     

    So, you can apply the formatting on another textinput i.e readyNum  on change event of the previous textinput.

    Might help you.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 20, 2012 12:18 AM   in reply to marciofermino

    Replace

    <mx:PhoneFormatter id="phFormatter" formatString="####-####" validPatternChars="#-() "/>


    with

     

    <mx:PhoneFormatter id="phFormatter" formatString="#####-#####" validPatternChars="#"/>

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 20, 2012 3:14 AM   in reply to marciofermino

    Post your error please.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 20, 2012 3:28 AM   in reply to marciofermino

    add the following property to PhoneNumberValidator

    allowedFormatChars="-"

     


     


     
    |
    Mark as:
  • Currently Being Moderated
    Feb 13, 2013 10:24 PM   in reply to marciofermino

    Can you post your code over here so that I can just check it?

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points