You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Brian Relph <re...@gmail.com> on 2007/10/26 18:49:20 UTC
onchange submit action
So I have a <form> with action = "template" and on this form i have several
submit buttons, with methods = "save", "restore", and "preview".
I also have some <a> links with href action urls - example:
<s:url action="template" method="view" id="view">
<s:param name="sponsor" value="%{sponsor}" />
<s:param name="type" value="#currentType" />
</s:url>
Finally, i have a select box, and i would like the select box to submit the
form to the "view" method when it changes. i have set the onchange
attribute = "dispatchForm(this.form)", which calls form.onSubmit() and then
form.submit().
However, since the action on the form is only "template", my view() method
is not called. But, if i change the action on the form to "template!view",
then my submit buttons do not call the correct method. Any ideas on how to
get around this?
Thanks,
Brian
Re: onchange submit action
Posted by Brian Relph <re...@gmail.com>.
A few more minutes of experimenting and i answered my own question ...
anyone else who wonders, instead of using
<s:submit cssClass="templateButton" value="%{getText('healthe.admin.save')}"
method="save" />
i used
<s:submit cssClass="templateButton" value="%{getText('healthe.admin.save')}"
action="template!save" />
and then changed the action for the form tag to be "template!view"
On 10/26/07, Brian Relph <re...@gmail.com> wrote:
>
>
> So I have a <form> with action = "template" and on this form i have
> several submit buttons, with methods = "save", "restore", and "preview".
>
> I also have some <a> links with href action urls - example:
>
> <s:url action="template" method="view" id="view">
> <s:param name="sponsor" value="%{sponsor}" />
> <s:param name="type" value="#currentType" />
> </s:url>
>
> Finally, i have a select box, and i would like the select box to submit
> the form to the "view" method when it changes. i have set the onchange
> attribute = "dispatchForm(this.form)", which calls form.onSubmit() and
> then form.submit().
> However, since the action on the form is only "template", my view() method
> is not called. But, if i change the action on the form to "template!view",
> then my submit buttons do not call the correct method. Any ideas on how to
> get around this?
>
> Thanks,
> Brian
>