If there is anyone out there can can help me with a JS problem, I would greatly appreciate it. I am just trying to validate a form before submission via JS. All I want to do is make sure tat 2 fields are not empty, and display an alert box and return false if they are. This is basic...I am just learning JS. 🙂
Right now, it works great is BOTH fields are left blank. When either one is populated, then it fails to alert and return false.
TIA!!!
<script language="JavaScript">
<!--
function checkForm(){
var manuf = document.myform.manu_make.value;
var type = document.myform.manu_type.value;
if((manuf == "") || (manuf == NULL))
var err1 = "Please fill out the manufacturer name.";
if((type == "") || (type == NULL))
var err2 = "Please select the manufacturer type.";
if(err1 !== "" || err2 !== ""){
alert(err1+"\n"+err2);
return false;
}
return true;
}
//-->
</script>