View Single Post
Old 01-22-2013, 07:46 AM   PM User | #5
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,100
Thanks: 197
Thanked 2,421 Times in 2,399 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Quote:
Originally Posted by xelawho View Post
because the validation has to follow the rules that the user dictates, so if they say for example that formats
XXX-XXXX
and
XX-XXXX-XXX

are valid, if they try to enter 22-343 it should fail validation
I am sure that you know what you are doing, but IMO excessive validation of telephone number formats is pointess when the user can simply make a mistake and enter his number wrongly, say with transposed digits. I would have thought that it would be enough to check for just digits and hyphens/spaces.

Surely there are only a limited number of valid formats?
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.

Last edited by Philip M; 01-22-2013 at 07:50 AM..
Philip M is offline   Reply With Quote