469,963 Members | 2,056 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,963 developers. It's quick & easy.

validating phone numbers

74
I'd love to be able to validate phone numbers in my software but my product is being used world wide.

Not everyone's phone number is formatted like USA/Canada formats theirs.
I've found a few sites that told me how international phone numbers are formatted and can figure out how to validate them quite easily from that...

But it doesn't make sense to ask people for their international phone numbers (I bet that most people don't know their country code!)

I am wondering if is even feasible to validate phone numbers?
I'm sure that many people have encountered this issue before. How did they get around it?

-LilOlMe
Jun 28 '07 #1
4 2966
LacrosseB0ss
113 100+
If it's a registration form or something you are coding, you can have specific input boxes that appear when a certain country is clicked. Canada/America will make the ### - ### - #### box visible. Whereas China or Australia or whatever else you got will show different boxes.

Depending on your development tool, I know Visual Studio has an object called a Validator you can link with another object. If the object doesn't mean certain criteria, the Validator will throw a flag and display an error message. On a submit button, if any of the validators are activated the submit will not go through. The reason I mention these is I think their format check string can be changed programatically.

There are 2 suggestions, hope they help.
- LB
Jul 9 '07 #2
lilOlMe
74
If it's a registration form or something you are coding, you can have specific input boxes that appear when a certain country is clicked. Canada/America will make the ### - ### - #### box visible. Whereas China or Australia or whatever else you got will show different boxes.

Depending on your development tool, I know Visual Studio has an object called a Validator you can link with another object. If the object doesn't mean certain criteria, the Validator will throw a flag and display an error message. On a submit button, if any of the validators are activated the submit will not go through. The reason I mention these is I think their format check string can be changed programatically.

There are 2 suggestions, hope they help.
- LB
Thank you for your reply LacrosseBoss!

It turns out that my requirements have changed in such a way that validating the phone number field would be pointless.

I'm sure this will be helpful for other people trying to validate phone numbers for multiple countries.

Thanks again!

-LilOlMe
Jul 10 '07 #3
LacrosseB0ss
113 100+
It is a common problem that I've faced before too. Usually they were for assignments so I stuck to North America. However, it can be done. Hope everything works out for you. Glad to help!

-LB
Jul 10 '07 #4
numberwhun
3,503 Expert Mod 2GB
I'd love to be able to validate phone numbers in my software but my product is being used world wide.

Not everyone's phone number is formatted like USA/Canada formats theirs.
I've found a few sites that told me how international phone numbers are formatted and can figure out how to validate them quite easily from that...

But it doesn't make sense to ask people for their international phone numbers (I bet that most people don't know their country code!)

I am wondering if is even feasible to validate phone numbers?
I'm sure that many people have encountered this issue before. How did they get around it?
Just a quick note though, should you have a project come up in the future where you do have to validate USA/Canada phone numbers, there are lists of valid area codes and prefixes (per city/state) available on the internet. You could get truely anal and not only validate the format (###-###-####), but also that the areacode matches the state and the prefix matches the city. Amazing what technology can allow us to do.

Regards,

Jeff
Jul 12 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by joemono | last post: by
4 posts views Thread by Brian Henry | last post: by
4 posts views Thread by Earl | last post: by
7 posts views Thread by laredotornado | last post: by
5 posts views Thread by lim4801 | last post: by
4 posts views Thread by Blue Streak | last post: by
7 posts views Thread by Propoflady | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.