Could someone please help me figure out why when I hit submit on this script I'm working on, it only gives me the first alert message and then goes ahead and submits the page. It seems to be ignoring the else if... and I've used the same exact format and got it to work before.
<script language="javascript">
<!--
function validEntries() {
//validate form
var txtWOID = frmOrder.txtWOID.value;
var txtVIN = parseFloat(frmOrder.txtVIN.value);
var txtWODate = new Date(frmOrder.txtWODate.value);
var selectValue = frmOrder.firstService.selectedIndex;
if (txtWOID == "") {
alert("Please enter a work order ID number");
return false;
} else if (txtVIN == "") {
alert("Please enter a VIN number");
return false;
} else if (txtWODate == "NaN") {
alert("Please enter a date in the format MM/DD/YYYY");
return false;
} else {
alert(txtWOID.value + "\n" + txtVIN.value + "\n" + txtWODate.value);
return true;
}
}
//-->
</script>
Thanks but I already tried that. I'm using Visual Studio.NET to code it and it automatically gives me an message that says "could not find any attribute onsubmit of element 'input'"
I tried it again and it just ignores the function altogether and just submits the page.
WAIT..... I changed it back to onclick and added the return and it worked. Thank you so much..... I would have never figured that out. I'm new at this. Thanks again.
Bookmarks