I am validating my form to see if a user didn’t enter data in a text box.
The code below works if they don’t enter data, but if they click in the box and press the spacebar it does not work. I want to test for both empty and null(which is what I think the spacebar is).
I know I have to change this line to test for both, but I am lost on how to appcomplish this. any ideas?
[b]
if ( document.test.elements[err[i]].value == “” )
Thanks
[code]
<script type=’text/javascript’>
function isEmpty()
{
var errmsg = new String();
var err = new Array(“req1”);
for(i=0;i<err.length;i++) {
if ( document.test.elements[err[i]].value == “” )
{
errmsg += “Error”;
}
}
if(errmsg.length > 0) {
alert(errmsg);
return false;
}
return true;
}
</script>