You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sunil Sahu <Su...@KeaneIndia.Com> on 2004/07/17 06:25:08 UTC
RE: NEWBIE: how to submit a named html:form via javascript
Adam,
Name parameter in form tag is optional. If you want to submit your page then
u can do it by supplying onclick event for default form.
<action path="/help" name="helpActionForm" scope="request"
type="com.expensys.expensyswt.struts.action.DisplayHelp" />
<html:form action="help.do">
<map name="Map">
<area shape="rect" coords="2,0,50,13" href=""
onclick="javascript:document.forms[0].submit();" >
</map>
</html:form>
nothing else is required.
sahu
-----Original Message-----
From: Adam Lipscombe [mailto:adam.lipscombe@expensys.com]
Sent: Saturday, June 26, 2004 3:01 AM
To: 'Struts Users Mailing List'
Subject: RE: NEWBIE: how to submit a named html:form via javascript
Thanks Jim,
If I understand you correctly, if I have this config in struts-config:
<action path="/help" name="helpActionForm" scope="request"
type="com.expensys.expensyswt.struts.action.DisplayHelp" />
Then I can use "javascript:document.helpActionForm.submit()" in the jsp file
to submit a form like this:
<html:form action="/help.do" method="POST">
....
</html:form>
Is my understanding correct?
TIA - Adam
-----Original Message-----
From: Jim Barrows [mailto:jbarrows@sssc.com]
Sent: 25 June 2004 18:31
To: Struts Users Mailing List
Subject: RE: NEWBIE: how to submit a named html:form via javascript
The name is optional. I never use it in the form. For JavaScript porpoises
I use the name of the
ActionForm your using in the struts config.
> -----Original Message-----
> From: Adam Lipscombe [mailto:adam.lipscombe@expensys.com]
> Sent: Friday, June 25, 2004 10:27 AM
> To: 'Struts Users Mailing List'
> Subject: NEWBIE: how to submit a named html:form via javascript
>
>
>
> Folks,
>
> I want to submit a named html:form. e.g.
>
> <html:form name="helpForm" action="/help" method="POST">
> <map name="Map">
> <area shape="rect" coords="2,0,50,13" href=""
> onclick="javascript:document.helpForm.submit()" >
> </map>
> </html:form>
>
>
> Wit the above construct Struts complains that the form
> requires a "type"
> attribute - it seems to want me to specify the classname of
> the ActionForm
> as the "type".
>
> My understanding is that Struts deduces the ActionForm to use
> automatically
> from the struts-config action definition. Is this correct?
>
>
> I know I could use "javascript:document.forms[n].submit()" but I would
> prefer to submit the named form so that if further forms are added to
> the page it does not mess up the submit.
>
> Is this possible? How?
>
>
> TIA - Adam
>
>
> ---------------------------------------------------------------------
> 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
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: NEWBIE: how to submit a named html:form via javascript
Posted by Buland Altaf <bu...@yahoo.com>.
Hi There,
Youi don't even need to give _javascript. As when your
jsp comples, it replaces your form tag attibute name
with the value u provided under action attribute name.
So if your acton tag is like this:-
<action path="/help" name="helpActionForm"
scope="request"
type="com.expensys.expensyswt.struts.action.DisplayHelp"
/>
Then you can use
"document.helpActionForm.submit()" in the jsp file
to submit a form like this:
<html:form action="/help.do" method="POST">
....
</html:form>
Regards,
Buland
--- Sunil Sahu <Su...@KeaneIndia.Com> wrote:
> Adam,
>
> Name parameter in form tag is optional. If you want
> to submit your page then
> u can do it by supplying onclick event for default
> form.
>
> <action path="/help" name="helpActionForm"
> scope="request"
>
type="com.expensys.expensyswt.struts.action.DisplayHelp"
> />
>
>
> <html:form action="help.do">
> <map name="Map">
> <area shape="rect" coords="2,0,50,13" href=""
>
> onclick="javascript:document.forms[0].submit();" >
> </map>
> </html:form>
>
> nothing else is required.
>
> sahu
>
>
>
>
>
> -----Original Message-----
> From: Adam Lipscombe
> [mailto:adam.lipscombe@expensys.com]
> Sent: Saturday, June 26, 2004 3:01 AM
> To: 'Struts Users Mailing List'
> Subject: RE: NEWBIE: how to submit a named html:form
> via javascript
>
> Thanks Jim,
>
>
> If I understand you correctly, if I have this config
> in struts-config:
>
> <action path="/help" name="helpActionForm"
> scope="request"
>
type="com.expensys.expensyswt.struts.action.DisplayHelp"
> />
>
> Then I can use
> "javascript:document.helpActionForm.submit()" in the
> jsp file
> to submit a form like this:
>
> <html:form action="/help.do" method="POST">
> ....
> </html:form>
>
>
> Is my understanding correct?
>
>
> TIA - Adam
>
>
>
>
> -----Original Message-----
> From: Jim Barrows [mailto:jbarrows@sssc.com]
> Sent: 25 June 2004 18:31
> To: Struts Users Mailing List
> Subject: RE: NEWBIE: how to submit a named html:form
> via javascript
>
>
> The name is optional. I never use it in the form.
> For JavaScript porpoises
> I use the name of the
> ActionForm your using in the struts config.
>
> > -----Original Message-----
> > From: Adam Lipscombe
> [mailto:adam.lipscombe@expensys.com]
> > Sent: Friday, June 25, 2004 10:27 AM
> > To: 'Struts Users Mailing List'
> > Subject: NEWBIE: how to submit a named html:form
> via javascript
> >
> >
> >
> > Folks,
> >
> > I want to submit a named html:form. e.g.
> >
> > <html:form name="helpForm" action="/help"
> method="POST">
> > <map name="Map">
> > <area shape="rect" coords="2,0,50,13"
> href=""
> > onclick="javascript:document.helpForm.submit()" >
> > </map>
> > </html:form>
> >
> >
> > Wit the above construct Struts complains that the
> form
> > requires a "type"
> > attribute - it seems to want me to specify the
> classname of
> > the ActionForm
> > as the "type".
> >
> > My understanding is that Struts deduces the
> ActionForm to use
> > automatically
> > from the struts-config action definition. Is this
> correct?
> >
> >
> > I know I could use
> "javascript:document.forms[n].submit()" but I would
> > prefer to submit the named form so that if further
> forms are added to
> > the page it does not mess up the submit.
> >
> > Is this possible? How?
> >
> >
> > TIA - Adam
> >
> >
> >
>
---------------------------------------------------------------------
> > 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
>
>
>
>
---------------------------------------------------------------------
> 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
=====
Buland Altaf Malik,
Software Engineer,
Softech System's(pvt)Ltd.
10/25 asad jan road lahore,cantt - 54810 Pakistan
Tel: 92-42-6665812 , 92-42-6660802
Mob: 0333-4344113
Fax: 92-42-6665792
http://www.softech.com.pk
buland_altaf@hotmail.com
__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org