You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Paul Benedict <pa...@yahoo.com> on 2006/01/21 01:19:41 UTC

Multiple Submit Buttons

What's the best way to accomplish this? I really dislike using the button text to find the correct
dispatch so I don't want to use LookupDispatchAction. Is there another way, such as using the
button's name to invoke the correct method? I thought I saw such a proposal in the API docs but I
can no longer find it.

Paul

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: Multiple Submit Buttons

Posted by Michael Jouravlev <jm...@gmail.com>.
On 1/20/06, Paul Benedict <pa...@yahoo.com> wrote:
> Laurie,
>
> I thought I saw a version of dispatchaction that could handle this. The parameter attribute
> contained a comma-delimited list of possible names and thus methods which could be invoked for the
> particular action. Do you remember this proposal?

Paul, try this: http://issues.apache.org/bugzilla/show_bug.cgi?id=30292

Michael.

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


Re: Multiple Submit Buttons

Posted by Paul Benedict <pa...@yahoo.com>.
Laurie,

I thought I saw a version of dispatchaction that could handle this. The parameter attribute
contained a comma-delimited list of possible names and thus methods which could be invoked for the
particular action. Do you remember this proposal?

Paul

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: Multiple Submit Buttons

Posted by Laurie Harper <la...@holoweb.net>.
Paul Benedict wrote:
> What's the best way to accomplish this? I really dislike using the button text to find the correct
> dispatch so I don't want to use LookupDispatchAction. Is there another way, such as using the
> button's name to invoke the correct method? I thought I saw such a proposal in the API docs but I
> can no longer find it.

You basically have two options (unless you're willing to have a 
dependency on Javascript): key off the localized button text, or give 
each submit button a different name. I prefer the latter solution as I 
think it's more robust:

   <input type="submit" name="edit" value="Edit"/>
   <input type="submit" name="delete" value="Delete"/>

...

   if (request.getParameter("edit") != null) {
     doEdit();
   } else if (request.getParameter("delete") != null) {
     doDelete();
   }

L.


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