By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,198 Members | 1,597 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,198 IT Pros & Developers. It's quick & easy.

validating phone numbers

P: 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
Share this Question
Share on Google+
4 Replies


LacrosseB0ss
100+
P: 113
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

P: 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
100+
P: 113
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
Expert Mod 2.5K+
P: 3,503
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.