Came across a rather annoying issue in the Flex PhoneNumberValidator class today, it seems that the minimum length of a phone number you can have is 10 (which is not the case in Ireland), and this value is hardcoded (see line 159 here, ick!).

Ended up hacking together a sub class with a configurable ‘minLength’ attribute, available here.

Also submitted a bug report to Adobe. We’re using Flex SDK beta3 and are eagerly awaiting the full release (for some time now, whats the story lads?), and also the move to making it fully open source (where I could of submitted a patch today instead of a bug report!)

3 Comments

  1. Fabio Biondi says:

    I always built custom validators and I never used the PhoneNumberValidator until today.

    So I opened the PhoneNumberValidator Class and I discovered it too.
    Amazing… I would like to know the monkey that has developed this component :)

    So, thanx a lot for your class.
    It works perfectly and I avoid to waste time to write it…

    Fabio

  2. John says:

    Great, thanks for the class. There’s only one thing I think its not working, when you set the property “required=false”, the validator is also triggered. The only way to fix it is to set the minlength to 0, missing that property…

  3. Brian Bishop says:

    Working on a Flex 3.2 project and this was very helpful, thanks. (the issue is resloved in the more recent Flex SDK releases)

Leave a Reply