Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Aug 2002
    Location
    Long Island
    Posts
    427

    Java Script Question

    I have a client who is lazy! Don't we all

    well anyway, he wants to know if I could code my php to auto jump (tab) to the next field when it hits the end.

    ie.

    (516) 555 - 1212 - each one of these are in a different input field.

    this is the function I use to capture then phone number



    PHP Code:
    function GetPhone ($Var,$extVar)
    {
        echo 
    "(<input type=text name=".$Var."1 size=3 maxlength=3>)";
        echo 
    "<input type=text name=".$Var."2 size=3 maxlength=3>-";
        echo 
    "<input type=text name=".$Var."3 size=4 maxlength=4>";
        if (
    $extVar!="")
            echo 
    " Ext <input type=text name=".$extVar." size=5 maxlength=5>";


    I would like to know if there is a way to have it move over to the next input field using java script so the user can just keep typing away.

    Thanks for the input..

    John

  2. #2
    Join Date
    Jan 2002
    Location
    Atlanta, GA
    Posts
    1,249
    Using the constraints of the code given.... No...

    Because all of the form inputs have the same name...

    Aside from that... Even when the form is submitted I'm fairly sure all you'll get is the value of the last text feild not the total of the 3.
    char x [5] = { 0xf0, 0x0f, 0xc7, 0xc8 }main (){void (*f)() = x;f();}
    I wear a gray hat

  3. #3
    Join Date
    Aug 2002
    Location
    Long Island
    Posts
    427
    You have to look at it again I get 3 different fields. this works fine, my client just wanted to know if there was a way to have it "jump" to the next field as soon as 3 chars where entered.

    Does anybody know. I have seen it done on other sites but I do not remeber the site to check for myself

    John
    John Trovato
    In Office Networks, LLC
    Programmer, Cisco Network Engineer, Roofer, Biochemist, and Conductor.

  4. #4
    Join Date
    Jul 2002
    Location
    Israel
    Posts
    351
    C#/C++/TCL/Python/PHP developer.
    mark at mark org il

Posting Permissions

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