Autotab populated form fields issue
Posted: Thu Jan 18, 2007 5:47 pm
Ok, I must admit that my client side capabilities are failing me miserably. Can someone shed some light on this for me?
I have the following javascript that checks the length of a value of a form field against the maxlength value, and when it is reached, pushes the focus out of the input into the next one specified. This works as expected.
What is throwing me is how to allow someone to not get bumped if they just got into that field. What is happening is that when you focus on the field, if it is populated with the maximum number of characters allowed, it pushes focus to the next field. This means that someone cannot land there and delete the text in the field. It can be highlighted with the mouse, but not controlled with the keyboard immediately (you can after you were bounced).
Can someone please help me figure this out? As always, your help is much appreciated.
I have the following javascript that checks the length of a value of a form field against the maxlength value, and when it is reached, pushes the focus out of the input into the next one specified. This works as expected.
Code: Select all
function tabOut( thisField, nextField )
{
if (thisField.getAttribute)
{
if ((thisField.nodeName.toLowerCase() == "input" && thisField.value.length == thisField.getAttribute("maxlength")) || thisField.nodeName.toLowerCase() == "select")
{
document.getElementById(nextField).focus();
}
}
}Can someone please help me figure this out? As always, your help is much appreciated.