I would like the form not to submit if I have errors. My script seems to work and I get the messages but the form still submits after the fact. Here is the code in its simplist form. Its probably something easy but it is driving me nuts.
<html>
<script language=”JavaScript”>
function IsBlank(value) {
for (var x = value.length – 1; x >= 0; x–) {
if ((value.charAt(x) != ” “) && (value.charAt(x) != “”)) {
return false;
}
}
return true;
}
function validateForm(form) {
if ((IsBlank(form.userid.value)) ||
(IsBlank(form.password.value))) {
alert(“Enter ID and Password”);
}
}
</script>
<form action=”/cgi-bin/signin” method=”post” onsubmit=”validateForm(this)”;>
Customer ID:<input type=”text” name=”userid” size=”10″>
Password:<input type=”password” name=”password”size=”10″></td>
<input type=”submit” value=”Sign In”>
</form>
</html>