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 2 of 2

Thread: auto tab

  1. #1
    New Coder
    Join Date
    Jul 2004
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question auto tab

    i built the code for this form but the auto tab doesn't work for the "zipcode" and "home phone" sections. it works everywhere else. i get an error stating that an object is missing in line 97 of my code which is the ( var index = -1, i = 0, found = false; ) line. Attached is the file itself. any suggestions
    Attached Files Attached Files

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Are you trying to do something like this?

    Code:
    <script type="text/javascript">
      function autoTab(input,maxLength){
       var el = document.forms[0].elements;
        for(var i=0; i<el.length; i++){
          if(el[i] == input && input.value.length == maxLength){
             el[i+1].focus();
             break;
          }
        }
      }
    </script>
    </head>
    
    <body>
    <form>
    <input type="text" size="2" maxlength="3" class="<?=errClass('HP:')?>"
    onkeyup="autoTab(this,3)">&nbsp;-&nbsp;
    <input type="text" size="3" maxlength="3" class="<?=errClass('HP:')?>"
    onkeyup="autoTab(this,3)" >&nbsp;-&nbsp;
    <input type="text" size="4" maxlength="4" class="<?=errClass('HP:')?>"
    onkeyup="autoTab(this,4)">
    <input type="submit" value="submit">
    </form>
    .....Willy

    BTW: This would be easier to do if your form elements had names assigned and FWIW, I'm somewhat curious to see how your form will submit without form element names...
    Last edited by Willy Duitt; 08-17-2004 at 09:56 PM.


  •  

    Posting Permissions

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