Thank you Matt and Peter for the suggestion.  It works!!!

----- Original Message -----
From: "Peter Guyatt" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Tuesday, October 21, 2003 10:42 AM
Subject: RE: JSP question


> Hi There,
>
> Why dont you change the button back to a submit and then add a
> onSubmit='return validation();' to you form ?
>
> Thats what we do
>
> Eg.
> <Script>
> function valid () {
> if (document.form.val.value.length < 1) {
> alert("Please enter a value");
> return false;
> }
> return true;
> }
> </Script>
>
> <form onSubmit="return valid();">
> <table>
> <tr>
> <td>
> <input type="text" name="val">
> </td>
> <td>
> <input type="submit">
> </td>
> </tr>
> </table>
> </form>
>
> Thanks
>
> Pete
>
> -----Original Message-----
> From: epyonne [mailto:[EMAIL PROTECTED]
> Sent: 21 October 2003 16:35
> To: Tomcat Users List
> Subject: JSP question
>
>
> Hello All,
>
> I am pulling my hair on this problem, and since there are many Java
experts
> on this mailing list, I hope someone can help me on this.
>
> I have a simple servlet that calls a JSP page where the user can enter a
> search value.  When the user clicks on the submit button, the search value
> will be passed back to the servlet for processing and display.  All these
> are running on Tomcat 4.1.24.
>
> Everything works fine until I added the form validation routine in the JSP
> page.  Initially, my input button type was "submit".  I changed it to
> "button" and leave the submission to the form validation routine which is
in
> JavaScript.  Now, when I click on the button, I get the error message of:
> "Object doesn't support this property or method"
> at the line of code:
> document.form1.submit();
>
> Does anyone know why?  The following is code of the JSP page:
> //code begin----------------------------------------------
> <html>
> <head>
> <title>blah blah blah</title>
> <link rel=stylesheet href="css/standard.css" type="text/css">
> </head>
>
> <body>
> <form name="form1" method="POST" action="">
> <center>
> <b>Please enter ANI for query:</b><br><br>
> <table>
> <tr>
>  <td>ANI</td>
>  <td><input type=text name="ani"></TD>
> </tr>
> <tr>
>  <td></td>
>  <td COLSPAN="2">
>  <input type="button" name="submit" value="Submit"
> onclick="javascript:validateForm();">
>  <input type="Reset" name="cmdReset" value="Reset"></td>
> </tr>
> </table>
> </center>
>
>  <script LANGUAGE="JavaScript">
>   function validateForm(){
>    if(document.form1.ani.value == ""){
>     alert("Please enter an ANI");
>     return;
>    }
>    document.form1.submit();        //This line generated error.  The
> .submit() method is not supported.
>   }
>  </script>
> </form>
> &nbsp;
> <%@ include file="footer.jsp"%>
> </body>
> </html>
> //code end------------------------------------------------
>
> Any help will be very much appreciated.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to