I have a function as follows:
function checkComplete(checkField)
{
alert(checkField.value);
if(checkField.value==""
{
alert("You have not completed the field"
;
checkField.focus();
checkField.select();
return false;
}
else
{
return true;
}
}
Essentially, if the field is blank it tells the user and returns the focus to it. It works fine unless the next field also uses the function as it ends up in an infinite loop swapping focus between the two. The function is called with onBlur(this) and I don't really want to use any other events that will need to be called in the HTML (such as onLostFocus..) as I'm writing a set of standard procedures for validation that I want to be as easy to plug in and use as possible.
Any ideas most welcome..
function checkComplete(checkField)
{
alert(checkField.value);
if(checkField.value==""
{
alert("You have not completed the field"
checkField.focus();
checkField.select();
return false;
}
else
{
return true;
}
}
Essentially, if the field is blank it tells the user and returns the focus to it. It works fine unless the next field also uses the function as it ends up in an infinite loop swapping focus between the two. The function is called with onBlur(this) and I don't really want to use any other events that will need to be called in the HTML (such as onLostFocus..) as I'm writing a set of standard procedures for validation that I want to be as easy to plug in and use as possible.
Any ideas most welcome..