Jump to content

Auto-tab Through Form Fields Not Working In 1 Place


mboehler3

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 comment
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 comment
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 comment
Share on other sites

The output layer of ASP.NET might be looking for event handlers and replacing them with its own, I'm not very familiar with ASP.NET so I can't really help with that.
Should I move this thread to the ASP section? If so, how do I do that?
Link to comment
Share on other sites

A mod would have to move it. It would also be a good idea to go through your Javascript code and look for anything that would remove the event handlers on those fields.
what do I look for in the JavaScript that would throw off the event handlers?
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...