473,385 Members | 1,587 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Phone Number Validation with Three Text Boxes?

Has anyone used three textboxes for phone number input and successfully
validated it?

One textbox for area code, one for exchange, one for number. (yes, we're
only doing US numbers) :o)

Nov 18 '05 #1
2 3255
Jeff:
Have you tried it yet? It doesn't seem like it would be hard to do.
Do you mean validating whether it is a real phone number, or just validating
the characters? I would use web controls for this, you know the
<asp:textbox... things, and set the max length accordingly, then write some
little functions such as ( I am into C# these days ):

public bool hasIllegalCharacters( String s )
{
if ( s has things like %, !, /, <SCRIPT> or INSERT in it )
{
return false;
}
return true;
}

then from lets say, a forms submit button click event:

String pnumber;
pnumber = ac.Text + ex.Text + number.Text;
if ( this.hasIllegalCharacters( pnumber) )
{
Response.Redirect("error.aspx");
}
else
{
Response.Redirect("Validated.aspx")
}

Is that what you were wondering?

Kevin Parkinson

"Jeff Kiesel" <sp@sp.com> wrote in message
news:O8**************@TK2MSFTNGP10.phx.gbl...
Has anyone used three textboxes for phone number input and successfully
validated it?

One textbox for area code, one for exchange, one for number. (yes, we're
only doing US numbers) :o)

Nov 18 '05 #2
You could use regular expression validation on each box, should be
relatively straightforward.

"Jeff Kiesel" <sp@sp.com> wrote in message
news:O8**************@TK2MSFTNGP10.phx.gbl...
Has anyone used three textboxes for phone number input and successfully
validated it?

One textbox for area code, one for exchange, one for number. (yes, we're
only doing US numbers) :o)

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: AnnMarie | last post by:
<script language="JavaScript" type="text/javascript"> <!-- function validate(theForm) { var validity = true; // assume valid if(frmComments.name.value=='' && validity == true) { alert('Your...
4
by: adam.lock | last post by:
Hi I have a form which has 10 list boxes on it, each with a select option with values 0 to 3. Once the user submits the form, I want to validate that only three of the list boxes have been...
1
by: Jeff Kiesel | last post by:
Has anyone used three textboxes for phone number input and successfully validated it? One textbox for area code, one for exchange, one for number. (yes, we're only doing US numbers) :o)
2
by: Sharon Traineanu via .NET 247 | last post by:
I'm using C#.net. I have a phone number in three asp textboxes. I'd like to make the phone number required, and validate to make sure only numbers have been entered. My main problem is I can't...
2
by: Shankar Mani via DotNetMonster.com | last post by:
Hi folks, I am facing a problem while using a DataGrid. I have a webform with a datagrid containing two text boxes for edit viz., countrycode and country name. Like wise I have two more text boxes...
7
by: CAradhana | last post by:
I have a textbox whose text should be of the format "xxx-xxx-xxxx" i.e if the user enters 1234567890 it should automatically show as 123-456-7890. How do i achieve this in ASP.NET with validations?
4
by: Earl | last post by:
I'm curious if there are others who have a better method of accepting/parsing phone numbers. I've used a couple of different techniques that are functional but I can't really say that I'm totally...
10
by: JackM | last post by:
I'm still working on validating the phone numbers that are entered on a form but have come across a problem I don't understand how to fix. I can handle most instances when it's in regular US...
1
by: Ganesh Muthuvelu | last post by:
Hello, I am using a Repeater control to display data and also allow data editing. I simply have text boxes in my repeater template and allow the user to make changes as needed.. I also allow...
2
by: ddog | last post by:
I have a form with 3 text fields (one of which is a zip code) and 5 combo boxes. The combo boxes are all set with the first value as 'selected' when the page is first displayed. The 3 text fields...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.