Phone Number Validation with Three Text Boxes?

Discussion in 'ASP .Net' started by Jeff Kiesel, Apr 16, 2004.

  1. Jeff Kiesel

    Jeff Kiesel Guest

    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) :eek:)
     
    Jeff Kiesel, Apr 16, 2004
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    > 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) :eek:)
    >
    >
    >
     
    Kevin Parkinson, Apr 18, 2004
    #2
    1. Advertising

  3. Jeff Kiesel

    Rick Spiewak Guest

    You could use regular expression validation on each box, should be
    relatively straightforward.

    "Jeff Kiesel" <> wrote in message
    news:...
    > 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) :eek:)
    >
    >
    >
     
    Rick Spiewak, Apr 23, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Zahoor
    Replies:
    1
    Views:
    847
    Darryl L. Pierce
    Nov 15, 2003
  2. chen selina
    Replies:
    0
    Views:
    912
    chen selina
    Jul 7, 2010
  3. ahmed k
    Replies:
    0
    Views:
    1,334
    ahmed k
    Sep 25, 2010
  4. Lamine Darbouche

    Populating three list boxes from the database

    Lamine Darbouche, Oct 6, 2003, in forum: ASP General
    Replies:
    2
    Views:
    132
    Lamine Darbouche
    Oct 8, 2003
  5. Josh
    Replies:
    1
    Views:
    102
    Lasse Reichstein Nielsen
    Oct 23, 2003
Loading...

Share This Page