works fine written this way :

<html>
<head>
<title>blah blah blah</title>
<link rel=stylesheet href="css/standard.css" type="text/css">
</head>
<body>
<script LANGUAGE="JavaScript">
 function validateForm(){
  if(document.form1.ani.value == ""){
   alert("Please enter an ANI");
   return;
  }
  document.form1.submit();
 }
</script>
<center>
<b>Please enter ANI for query:</b><br><br>
<form name="form1" method="POST" action="">
<table>
 <tr>
  <td>ANI</td>
  <td><input type=text name="ani"></td>
 </tr>
 <tr>
  <td COLSPAN="2">
   <input type="button" value="Send" onclick="javascript:validateForm()">
  </td>
 </tr>
<table>
</form>
</body>
</html>
----- Original Message ----- 
From: "epyonne" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Tuesday, October 21, 2003 5:35 PM
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]

Reply via email to