On 11/7/05, Scott Piker <[EMAIL PROTECTED]> wrote:
> 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();
>        }
> }
>
<snip/>

If you want to save an additional script tag/function:
<a href="..." onclick="return validateAddressForm(this);">...</a>

Pointers:
What constitues a HTML form submission (and hence triggers the form
onsubmit handler)?
[ http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.3 ]

-Rahul



> 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,
> >
<snap/>

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

Reply via email to