I have a form in form.html and the action for processing its form is called
add.jsp, I want to make sure that the fields are valid, but when I submit
the form get processed even if the fields are empty, please help me.
the form.html is like this :
<html>
......
<script language="JavaScript">
function validateForm () {
if (document.form1.l_name.value.length == 0 || document.form1.l_name.value
== "") {
alert ("Referred by last name should not be empty");
return (false);
} else if (document.form1.f_name.value.length == 0 ||
document.form1.f_name.value == "") {
alert ("Referred by first name should not be empty");
return (false);
} else return true;
}
</script>
<form name="form1" action="addrewarded.jsp" method=POST onSubmit="return
validateForm()">
........
</html>
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets