You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nisith Dash <ni...@tcscal.co.in> on 2003/12/08 13:28:15 UTC

how to submit form using
Hi,

Can anyone of you help me with this..i have a hyperlink in my JSP on clicking which i want to submit an action form with some request parameters along with the form.Clicking the hyperlink in the JSP should ideally perform the following task which is done by this javascript below:

function x ( arg1)
{
 document.ActionFormName.action = "../../someAction.do?method=subMethodName&newSearch=true&key=" + arg1;
 document.ActionFormName.submit(); 
}

I have tried using the <html:link href="" </html:link>, <html:link page="" </html:link>, but though the action is being called, the Action Form is not being submitted to the
action class. I am not quite sure whether <html:link forward="" </html:link> will help as i don't know how to use it in the present scenario.

Thanks in advance for any suggestion to the above.

Nisith

RE: how to submit form using Posted by Tim Lucia <ti...@yahoo.com>.
This works for me:

<html:link href="#"
onclick="document.courseForm.submit();">Done</html:link>

Put whatever javascript you want in the onclick handler.

Tim Lucia

> -----Original Message-----
> From: Nisith Dash [mailto:nisith_das@tcscal.co.in] 
> Sent: Monday, December 08, 2003 7:51 AM
> To: Struts Users Mailing List
> Subject: Re: how to submit form using <html:link tag
> 
> 
> in case <html:link>  is specified , you have to give either a 
> forward, or a href or a page attribute. onclick will not work 
> here..the error is:
> 
>  Cannot create rewrite URL: java.net.MalformedURLException: 
> You must specify exactly one of "forward", "href",
> 
> how can i specify the forward attribute so that my purpose is 
> achieved.
> 
> ----- Original Message -----
> From: "Tim Lucia" <ti...@yahoo.com>
> To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
> Sent: Monday, December 08, 2003 6:13 PM
> Subject: RE: how to submit form using <html:link tag
> 
> 
> > <html:link ... onclick="x(arg); ..."/>
> >
> > Tim Lucia
> >
> > -----Original Message-----
> > From: Nisith Dash [mailto:nisith_das@tcscal.co.in]
> > Sent: Monday, December 08, 2003 7:28 AM
> > To: Struts Users Mailing List
> > Subject: how to submit form using <html:link tag
> >
> >
> > Hi,
> >
> > Can anyone of you help me with this..i have a hyperlink in 
> my JSP on 
> > clicking which i want to submit an action form with some request 
> > parameters along with the form.Clicking the hyperlink in the JSP 
> > should ideally perform the following task which is done by this 
> > javascript
> > below:
> >
> > function x ( arg1)
> > {
> >  document.ActionFormName.action = 
> > 
> "../../someAction.do?method=subMethodName&newSearch=true&key="
>  + arg1;  
> > document.ActionFormName.submit(); }
> >
> > I have tried using the <html:link href="" </html:link>, <html:link 
> > page="" </html:link>, but though the action is being called, the 
> > Action Form is not being submitted to the action class. I 
> am not quite 
> > sure whether <html:link forward="" </html:link> will help 
> as i don't 
> > know how to use it in the present scenario.
> >
> > Thanks in advance for any suggestion to the above.
> >
> > Nisith
> >
> >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
> 
> 



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


RE : how to submit form using Posted by Franck <fl...@orangecaraibe.com>.
If you don't want to use Javascript to submit your form,
I think you can use a submit button with a special CSS (on IE).
The submit button will then looks like an hyperlink.

Bye

--
Franck Lefebure


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


Re: how to submit form using Posted by Nisith Dash <ni...@tcscal.co.in>.
in case <html:link>  is specified , you have to give either a forward, or a
href or a page attribute. onclick will not work here..the error is:

 Cannot create rewrite URL: java.net.MalformedURLException: You must specify
exactly one of "forward", "href",

how can i specify the forward attribute so that my purpose is achieved.

----- Original Message -----
From: "Tim Lucia" <ti...@yahoo.com>
To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
Sent: Monday, December 08, 2003 6:13 PM
Subject: RE: how to submit form using <html:link tag


> <html:link ... onclick="x(arg); ..."/>
>
> Tim Lucia
>
> -----Original Message-----
> From: Nisith Dash [mailto:nisith_das@tcscal.co.in]
> Sent: Monday, December 08, 2003 7:28 AM
> To: Struts Users Mailing List
> Subject: how to submit form using <html:link tag
>
>
> Hi,
>
> Can anyone of you help me with this..i have a hyperlink in my JSP on
> clicking which i want to submit an action form with some request
> parameters along with the form.Clicking the hyperlink in the JSP should
> ideally perform the following task which is done by this javascript
> below:
>
> function x ( arg1)
> {
>  document.ActionFormName.action =
> "../../someAction.do?method=subMethodName&newSearch=true&key=" + arg1;
>  document.ActionFormName.submit();
> }
>
> I have tried using the <html:link href="" </html:link>, <html:link
> page="" </html:link>, but though the action is being called, the Action
> Form is not being submitted to the
> action class. I am not quite sure whether <html:link forward=""
> </html:link> will help as i don't know how to use it in the present
> scenario.
>
> Thanks in advance for any suggestion to the above.
>
> Nisith
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


RE: how to submit form using Posted by Tim Lucia <ti...@yahoo.com>.
<html:link ... onclick="x(arg); ..."/>

Tim Lucia

-----Original Message-----
From: Nisith Dash [mailto:nisith_das@tcscal.co.in] 
Sent: Monday, December 08, 2003 7:28 AM
To: Struts Users Mailing List
Subject: how to submit form using <html:link tag


Hi,

Can anyone of you help me with this..i have a hyperlink in my JSP on
clicking which i want to submit an action form with some request
parameters along with the form.Clicking the hyperlink in the JSP should
ideally perform the following task which is done by this javascript
below:

function x ( arg1)
{
 document.ActionFormName.action =
"../../someAction.do?method=subMethodName&newSearch=true&key=" + arg1;
 document.ActionFormName.submit(); 
}

I have tried using the <html:link href="" </html:link>, <html:link
page="" </html:link>, but though the action is being called, the Action
Form is not being submitted to the
action class. I am not quite sure whether <html:link forward=""
</html:link> will help as i don't know how to use it in the present
scenario.

Thanks in advance for any suggestion to the above.

Nisith



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