TheCandyman
Technical User
I have a simple for in which i'm trying to force the fields to be entered and not left blank. I have some js code which shows the warning "Please fill in..." but still submits anyways. I double checked, and the names for the input boxs are correct to the javascript. I need another pair of eyes on this, because i can't seem to find the problem. Anyone see it?
Form
Code:
<script language="JavaScript" type="text/javascript">
function validateForm() {
with (document.form1) {
var alertMsg = "Please fill in the following attendee information:\n";
if (FirstName.value == "") {alertMsg += "\n- First Name"}
if (LastName.value == "") {alertMsg += "\n- Last Name"}
if (title.value == "") {alertMsg += "\n- Badge Name"}
if (alertMsg != "Please fill in the following attendee information:\n") {
alert(alertMsg);
return false;
} else {
return true;
} } }
</script>
Form
Code:
<form ACTION="page.asp" method="post" name="form1" onsubmit="return validateForm()">