Try putting the if's the other way around.
Code:
if(document.test.custComment.value === "")
EXAMPLE:
Code:
function validateForm() {
var e=false,w=[];
if(document.test.custName.value === '') {
w[0] = "Please enter your name.";
e = true;
}
if(document.test.email.value === '') {
w[1] = "Please enter your email address.";
e = true;
}
if(document.test.custComment.value === '') {
w[2] = "Please enter your comment.";
e = true;
}
if(e) {
alert(w.join("\n"));
return false;
}
}
EDIT:
Are you using the function in a button onclick action or the form onsubmit action?
__________________
Official
BinPress hand picked coder.
For anyone worried about SQL injection go have a look at my small yet powerful script
here.
Go Pledge for
Light Table, if it hit's $300,000 Python and other languages will get added.
I am 1 of 65,608 people to get a Pebble Watch :P