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
Re: Javascript ( validation form)
Shah, Maulik (GEAE, Foreign National) Mon, 19 Feb 2001 06:49:46 -0800
- Javascript ( validation form) sufi malak
- Re: Javascript ( validation for... Dawei Jiang
- Re: Javascript ( validation for... Shah, Maulik (GEAE, Foreign National)
- Re: Javascript ( validation for... Imran Baig