hello everybody,
the following javascript should check each field as user passes through but its not working.
anyideas?
all i want to do at this time is check to see if the field is empty or not as client moves on to the next field.
<html>
<head>
<title> field test </title>
<head>
<script Language="JavaScript">
function checkfield(entered, alertbox)
{ with (entered)
{ if (value==null || value=="")
{ if (alertbox!="")
{ alert(alertbox);
}
return false;
}
else
{ return true;
}
}
}
</script>
</head>
<body>
<form method="post" action="test2.html">
<p>First name: <input type="text" name="fname" size="32" value="" onChange = "checkfield(this, 'required field');"><br>
Last name: <input name="lname" type="text" size="32" value ="" onChange = "checkfield(this, 'required field');"><br>
<p><input type="submit" value="Submit" name="submit"></p>
</form>
</body>
</html>
the following javascript should check each field as user passes through but its not working.
anyideas?
all i want to do at this time is check to see if the field is empty or not as client moves on to the next field.
<html>
<head>
<title> field test </title>
<head>
<script Language="JavaScript">
function checkfield(entered, alertbox)
{ with (entered)
{ if (value==null || value=="")
{ if (alertbox!="")
{ alert(alertbox);
}
return false;
}
else
{ return true;
}
}
}
</script>
</head>
<body>
<form method="post" action="test2.html">
<p>First name: <input type="text" name="fname" size="32" value="" onChange = "checkfield(this, 'required field');"><br>
Last name: <input name="lname" type="text" size="32" value ="" onChange = "checkfield(this, 'required field');"><br>
<p><input type="submit" value="Submit" name="submit"></p>
</form>
</body>
</html>