That's because, by design, a javascript submit() call does not invoke whatever's established as the form's onSubmit action. It's not a struts thing, it's a javascript/web browser thing.
In these situations, just call the validation function directly in your javascript, e.g.: function doIt(form) { if validateAddressForm(form) { form.submit(); } } HTH, - Scott > -----Original Message----- > From: Jim Reynolds [mailto:[EMAIL PROTECTED] > Sent: Monday, November 07, 2005 2:49 PM > To: user@struts.apache.org > Subject: Difference between <html:submit> and JS submit. > > I posted this email a week ago, and received no response, so > I am going to try again and change my verbage. > > Below is a JSP file which uses struts client-side validation. > The validtion works great when you use either the > <html:submit> or a normal<input type="submit">. This is all good. > > Problem is, when you use legal javascript to submit the form, > the validation does NOT work. Myself and other co-workers > cannot understand why this is? Does anyone know why? > > The JSP file is below, and can easily be run and played with. > I really was hoping someone had an idea why, because I would > like to perform the client-side and need to change actions, > etc. with JS. > > Thanks, > > > IHere is the jsp page, in case one sees something odd: > > <%@ include file="/tags.jsp" %> > > <html:html locale="true"> > <head> > <title>fyi</title> > <html:base/> > </head> > <body bgcolor="white"> > <html:form action="/AddressJavascriptValidation" method="post" > onsubmit="return validateAddressForm(this);"> > > <td align="center" colspan="2"> > <font size="4"><b>Please Enter the Following > Details</b></font> </tr> <tr> <td align="right"> <b>Name</b> > </td> <td align="left"> <html:text property="name" size="30" > maxlength="30"/> </td> </tr> <tr> <td align="right"> > <b>Address</b> </td> <td align="left"> <html:text > property="address" size="30" maxlength="30"/> </td> </tr> > > > // HERE IS A LINK USING SIMPLE JAVASCRIPT TO SUBMIT THAT // > FAILS.******************************************************** > ************ > > <a href="javascript:document.AddressForm.submit()">doit</a> > > <tr> > <td align="right"> > <b>E-mail address</b> > </td> > <td align="left"> > <html:text property="emailAddress" size="30" maxlength="30"/> > </td> </tr> > > <tr> > <td align="right"> > <html:submit>Save</html:submit> > </td> > <td align="left"> > <html:cancel>Cancel</html:cancel> > </td> > </tr> > </table> > </div> > > <!-- Begin Validator Javascript Function--> <html:javascript > formName="AddressForm"/> > <!-- End of Validator Javascript Function--> > > </html:form> > </body> > </html:html> > > --------------------------------------------------------------------- > 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]