Jump to content

Auto-tab Through Form Fields Not Working In 1 Place


Recommended Posts

I want to make the phone number fields on my site's forms auto-tab, once numbers are entered. Here are example links that work:On the right-hand side:http://www.surepayroll.com/quote/instant_price_quote.aspDown the page on the right:http://www.surepayroll.com/product/payroll...ll-services.aspOn the left-hand side:http://www.surepayroll.com/calculator/calc...heck_netpay.aspMy problem page is here, which uses the same code (see below):http://www.surepayroll.com/spsite/resource...les/default.aspThe actual form is an include file, and what I am confused about is that when I go to the actual include file, auto-tabbing works. It does not on the actual page it is on.All of these js files have this code that enables auto-tabbing:

		var isNN = (navigator.appName.indexOf("Netscape")!=-1);		function autoTab(input,len, e) {		  var keyCode = (isNN) ? e.which : e.keyCode; 		  var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];		  if(input.value.length >= len && !containsElement(filter,keyCode)) {			input.value = input.value.slice(0, len);			input.form[(getIndex(input)+1) % input.form.length].focus();		  }		  function containsElement(arr, ele) {			var found = false, index = 0;			while(!found && index < arr.length)			if(arr[index] == ele)			found = true;			else			index++;			return found;		  }		  function getIndex(input) {			var index = -1, i = 0, found = false;			while (i < input.form.length && index == -1)			if (input.form[i] == input)index = i;			else i++;			return index;		  }		  return true;		}

And then in the actual code I throw

onKeyUp="return autoTab(this, 3, event);"

into the input fields.Thank you for any help you can provide!

Link to post
Share on other sites

There aren't any event handlers on those fields.

			<p>Phone<br>			<input name="Phone1" size="3" maxlength="3" type="text" tabindex="5"> <input name="Phone2" size="3" maxlength="3" type="text" tabindex="6"> <input name="Phone3" size="4" maxlength="4" type="text" tabindex="7"><br>

Link to post
Share on other sites
There aren't any event handlers on those fields.
			<p>Phone<br>			<input name="Phone1" size="3" maxlength="3" type="text" tabindex="5"> <input name="Phone2" size="3" maxlength="3" type="text" tabindex="6"> <input name="Phone3" size="4" maxlength="4" type="text" tabindex="7"><br>

Yes, but if you go to the actual include file's url: http://www.surepayroll.com/include/quote/gfe_green_vid.asp you will see the event handlers are there. But when you go to the page that uses the include file, it's vanishes.Doesn't make sense to me.
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...