View Full Version : auto tab

08-17-2004, 05:48 PM
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

Willy Duitt
08-17-2004, 10:52 PM
Are you trying to do something like this?

<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){

<input type="text" size="2" maxlength="3" class="<?=errClass('HP:')?>"
<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:')?>"
<input type="submit" value="submit">


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...