Got more questions? Find advice on: SQL | XML | Regular Expressions | Windows
Welcome to AspAdvice Sign in | Join | Help

Newbie Question! Formatting a Phone-number entry field

  •  12-18-2006, 4:01 AM

    Newbie Question! Formatting a Phone-number entry field

    Hello,

    I have an existing asp.net page that asks for a customer's US phone number. Unfortunately, the field is set up to only accept entries in an unbroken number string, i.e.

    6178899923

    instead of

    617-889-9923 or (617) 889-9923

    How might I set up the field to accept phone numbers in one of these formats? I don't care as much how the number is stored in SQL, rather I want to make it easier for the customer. The unbroken string format is not familiar to a typical US user, and the form currently returns an error if dashes or brackets are used. For reference:

    <code><tr>
                      <td width="110" class="content"> Phone
                      </td>
                      <td><input name="sphone" type="text" id="sphone" size="20" maxlength="15" style='BACKGROUND-COLOR: lavender' value='<%=sphone%>' /></td>
                    </tr></code>

    Thank you very much.
    Filed under: , , ,
View Complete Thread