Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    Sep 2002
    Location
    San Antonio, TX
    Posts
    57
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Autoformat Phone Number

    Quick question regarding an AutoFormat Phone Number script that I found here:

    http://www.multi.com/Coding/FormatPhone.html

    There seems to be a small bug….when you type in the first 4 numbers, and it shows (xxx)x and then you delete two characters back to (xx…..the next character typed causes it to do (xx)x


    Any idea how to fix this? Would be much appreciated!
    ----------------------------------------
    *Let's All Do Kamikaze Shots!*
    http://www.kamikazeshots.com

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    349
    Thanks
    2
    Thanked 0 Times in 0 Posts
    hmmm,
    works fine for me..

    it won't let me delete any numbers pass this point.

    x(xxx

    so it always works. I am on a linux box.

  • #3
    New Coder
    Join Date
    Sep 2002
    Location
    San Antonio, TX
    Posts
    57
    Thanks
    3
    Thanked 0 Times in 0 Posts
    hmmm....

    when you type in a full phone number (all 10 digits) and then delete all the way back to the opening ( but not deleting it. And then typing 10 more numbers, it formats correctly?
    ----------------------------------------
    *Let's All Do Kamikaze Shots!*
    http://www.kamikazeshots.com

  • #4
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    It seems to be an IE thing, works fine in firefox.

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    Flint, Michigan, USA
    Posts
    617
    Thanks
    1
    Thanked 20 Times in 20 Posts
    I like to let a user enter the telephone number in any format s/he likes, and then I reformat it to what I want using a JavaScript function.

    For a demonstration, go to the "Samples of my work > Order form" page at "http://spruce.flint.umich.edu/~jalarie/" and fill in the "Telephone" box. When you tab out of it, the number will be reformatted to put parenthesis around the area code, a dash after the first three digits, and the extension number after an "x". You may use upper-case letters like "1-800-2RAMADA" or "800-HOLIDAY" if you like.

    The code is too long to post; if you'd like a copy, please e-mail me directly at "jalarie@umich.edu" and request a copy of "phonfmt1.js" file.

  • #6
    New Coder
    Join Date
    Sep 2002
    Location
    San Antonio, TX
    Posts
    57
    Thanks
    3
    Thanked 0 Times in 0 Posts
    I like how your script reformats after the user tabs out of the field. Question about the script, say a user types in the 10 digits and then clicks on a submit button....does the script still format the text box when the submit is sent?
    ----------------------------------------
    *Let's All Do Kamikaze Shots!*
    http://www.kamikazeshots.com

  • #7
    New Coder
    Join Date
    Sep 2002
    Location
    San Antonio, TX
    Posts
    57
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Brandoe85
    It seems to be an IE thing, works fine in firefox.
    I just tried the script in Firefox....and there seems to be a different prob in Firefox....type in all 10 numbers....and then start deleting back, and I am not able to delete past the )....can't delete the (xxx without highlighting and deleting.....
    ----------------------------------------
    *Let's All Do Kamikaze Shots!*
    http://www.kamikazeshots.com

  • #8
    Regular Coder
    Join Date
    Jun 2002
    Location
    Flint, Michigan, USA
    Posts
    617
    Thanks
    1
    Thanked 20 Times in 20 Posts
    Quote Originally Posted by OpenIntro
    I like how your script reformats after the user tabs out of the field. Question about the script, say a user types in the 10 digits and then clicks on a submit button....does the script still format the text box when the submit is sent?
    Yes, it does.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •