3 Replies Latest reply on Jan 19, 2007 6:41 PM by Newsgroup_User

    PhoneFormatter doesn't work

    DangerAhead
      The phone formatter doesn't work.
      Run this simple test to see:
      1. created a TextInput field with the id of "day_phone_input"
      2. enter this a number formatted like this: (415) 555-1212
      and format it with the AS below and it throws an error.

      I looked in the PhoneFormatter class and it has a line where it checks to see if the incoming format text is NaN:

      if (!value || String(value).length == 0 || isNaN(Number(value)))
      {
      error = defaultInvalidValueError;
      return "";
      }

      Why is it performing a Number Check on the incoming string that has non-number characters?
        • 1. Re: PhoneFormatter doesn't work
          Level 7
          DangerAhead,

          > I looked in the PhoneFormatter class and it has a line
          > where it checks to see if the incoming format text is NaN:

          What PhoneFormatter class? Is this something you coded, or a 3rd party
          script?


          David Stiller
          Adobe Community Expert
          Dev blog, http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. PhoneFormatter doesn't work
            DangerAhead Level 1
            Many new Out-of-the-box classes are coming with AS 3.0 to you Flashers so be prepared.
            PhoneFormatter is a class that comes out of the box with Flex AS 3.0. Along with support for Regular Expressions (regex)

            In any event, the formatter will work if you strip all non-numeric characters before sending the string to the formatter. stripping non-numeric characters with this script works:
            • 3. Re: PhoneFormatter doesn't work
              Level 7
              DangerAhead,

              > Many new Out-of-the-box classes are coming with AS
              > 3.0 to you Flashers so be prepared.

              Aye, aye!

              > PhoneFormatter is a class that comes out of the box with
              > Flex AS 3.0. Along with support for Regular Expressions
              > (regex)

              Regex is fantastic and is supported by ActionScript 3.0 proper.
              PhoneFormatter appears to be a library that ships with Flex. So it may rely
              on AS3, but isn't a native facet of the language.

              Flashers may never actually see it! ;)


              David Stiller
              Adobe Community Expert
              Dev blog, http://www.quip.net/blog/
              "Luck is the residue of good design."