struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Addy Kapur <addy.ka...@gmail.com>
Subject Re: help : submit with javascript problem
Date Sun, 10 Oct 2004 18:49:26 GMT
I am using the following function to dynamically assign the action
name and then submit the form. I am using <html:submit> tag.

function SubmitForm(action){
        document.forms[0].userAction.value = action;
        document.forms[0].submit();
}

<html:submit value='save' onclick="SubmitForm('save');" />

On Sun, 10 Oct 2004 13:42:21 -0500, Neil Erdwien <neil@k-state.edu> wrote:
> 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@paradyne.co.in ]
> > 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@struts.apache.org 
> > For additional commands, e-mail: user-help@struts.apache.org 
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org 
> > For additional commands, e-mail: user-help@struts.apache.org 
> >
> 
> --
> Neil Erdwien, neil@k-state.edu , Web Technologies Manager
> Computing and Network Services, Kansas State University
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org 
> For additional commands, e-mail: user-help@struts.apache.org 
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message