I think the piece you're missing is that the <input type="button"...>
tag is only valid inside a FORM element according to the HTML standards.
If I remember correctly from the last time I misplaced the element, the
browsers differ on their implementation in this case. Mozilla/Firefox
do the right thing. IE ignores mouse clicks on the button entirely.
I second the removing of the "javascript:". Even if it works, it isn't
needed.
Erez Efrati wrote:
> I don't see any problem with your code on first sight.
> Do you have more than one form in the page? Is the page you're trying to
>
> Submit is the first one in the page?
>
> Try putting the name of the form instead of forms[0].submit do
> Document.<name-of-your-form>.submit();
>
> And also, in your onclick="..." do just onclick="callSumbit();" (remove
> the 'javascript' token.
>
> If it still gives you errors give us the error log so it would be easier
> to
> Help you.
>
> Hope this helps,
> Erez
>
> -----Original Message-----
> From: sachin [mailto:sachin.hegde@(protected)]
> Sent: Saturday, October 09, 2004 5:29 PM
> To: Struts Users Mailing List
> Subject: help : submit with javascript problem
>
> hello all ,
>
> i have a struts form and a button outside the form.
> on button click , with javascript i need the submit the form
>
> any help is welcome.
>
> My code is like following. but does not work
>
> <html:form action="/something.do">
> ....
> </html:form>
>
> <input type="button" onClick="javascript:callSubmit()">
>
> <script>
> function callSubmit() {
> document.forms[0].submit();
> }
> </script>
>
> Sachin Hegde
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
--
Neil Erdwien, neil@(protected)
Computing and Network Services, Kansas State University
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)