Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Whats the best way to validate a phone number is correct on a web form

Posted on 2014-12-15
9
Medium Priority
?
180 Views
Last Modified: 2014-12-16
Is there a good way to check a phone number is correct on a web form like a postcode lookup to find the address. We already check the digits but is there a better way?
0
Comment
Question by:grovenetsupport
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 40501004
Using some sort of RegEx would be the right way to go.  How you implement it depends on the technology you're using.
0
 
LVL 25

Expert Comment

by:Ron Malmstead
ID: 40501046
There are caveats to this..
You can check if a phone number has a valid area code and prefix.. but you can't be sure that it is a working number, or that the number hasn't been "ported" to a cellphone.  To do this you would need a database through NANPA.com

If you just want to check the area code.. you can get the list here nanpa
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40501048
Are you asking to verify the format of the phone number or if the phone number itself is real and valid?
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 

Author Comment

by:grovenetsupport
ID: 40501180
Both as we receive leads via a web form from joe public and they are forever putting wrong phone numbers in?
0
 

Author Comment

by:grovenetsupport
ID: 40501189
PS needs to be UK version
0
 
LVL 34

Accepted Solution

by:
Paul MacDonald earned 2000 total points
ID: 40501195
Again, without knowing any of the technology you're using, this should get you started.
0
 

Author Comment

by:grovenetsupport
ID: 40501232
Cms is umbraco if that helps?
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40501444
Verifying the format of a phone number is pretty simple.  I'm sure Umbraco has a form handler that can validate different types of inputs and you can work with it from there.  To properly validate a phone number, you do need to use both client and server-side validations and regular expressions, so follow on with paulmacd's suggestions to get started.

Validating to see if the phone number is actually correct and rings an actual phone is a completely different animal.  Broadly speaking, there are two ways to go about it:

1) Use a database/API such as http://www.phone-validator.net/ and check the submitted number that way.  I have some doubts as to the accuracy of databases and APIs

2) Instead of checking the number, actually call the phone number entered by the user and have them enter a code that is read to them by a computer-generated voice.  This is broadly similar to two-factor authentication used to secure logins.  If you can get away with only demanding a mobile number, you can make this a lot easier by texting the code to the user instead of doing the audio call.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Geo-targeting is the practice of distributing content based on a person’s location, as best as you can determine it. Let’s look at some ways you could successfully use this tactic. The following tips and case studies could lead to meaningful results.
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
The purpose of this video is to demonstrate how to Import and export files in WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Click on Too…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question