I have tried the code sent by you in both IE and Netscape. The only reason I
found was that your code given below is properly formated.
<form name="form1" action="addrewarded.jsp" method=POST onSubmit="return
validateForm()">
Either take whole text including onSubmit="return in next line or add space
after return. As there is no space after return hence code is not working
properly. Try
<form name="form1" action="addrewarded.jsp" method=POST
onSubmit="return validateForm()">
OR
<form name="form1" action="addrewarded.jsp" method=POST onSubmit="return
validateForm()">
"Shah, Maulik (GEAE, Foreign National)" <[EMAIL PROTECTED]> on 02/19/2001
07:59:34 PM
Please respond to A mailing list about Java Server Pages specification and
reference <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
cc: (bcc: Imran Baig/CresSoft)
Subject: Re: Javascript ( validation form)
check if the textbox has some spaces ..due to which it is neither getting
the length as 0 nor getting the value ""
Maulik
-----Original Message-----
From: sufi malak [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 13, 2001 11:18 AM
To: [EMAIL PROTECTED]
Subject: Javascript ( validation form)
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
===========================================================================
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
===========================================================================
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