Hi,
I have some code set up on a textbox to try and prevent the user from trying to enter data elsewhere if the textbox is invalid.
e.g.
<input type="text" id="i1" onchange="test(this)"></input>
..
test(ele)
{
if(ele.value=="" || ele.value ==null)
{
alert("error");
ele.focus();
}
}
The problem is, if i press the tab button, the textbox loses its focus. Basically, I want to force the user to correct their error before moving onto type into another text box or select something else on the webpage. Focus code does not always seem to be called.
How do i go about doing this?
Regards,
MrPeds
I have some code set up on a textbox to try and prevent the user from trying to enter data elsewhere if the textbox is invalid.
e.g.
<input type="text" id="i1" onchange="test(this)"></input>
..
test(ele)
{
if(ele.value=="" || ele.value ==null)
{
alert("error");
ele.focus();
}
}
The problem is, if i press the tab button, the textbox loses its focus. Basically, I want to force the user to correct their error before moving onto type into another text box or select something else on the webpage. Focus code does not always seem to be called.
How do i go about doing this?
Regards,
MrPeds