Hi, Every now and then somebody asks the list how to deal with forms where they have multiple submit buttons. Depending on the clicked button one want different commands executed or different actions. The suggested solutions are usually to set the name of the button to "command" and the value to the command to execute. This only works for non i18n cases, and does not work if you want different actions to execute. The other easy way is to use client javascript to set the form action, but many people do not like that either.
I have a solution where the name of the submit button is used to specify the action/command to execute. Example: <form action="_wwaction_com.package.DefaultAction.action" method="POST"> <input type=submit name="_wwaction_com.package.MyAction" value="Localized message"> <input type=submit name="_wwaction_com.package.OtherAction!someCommand" value="Another message"> </form> This is implemented in a few lines of code in the ServletDispatcher getActionName method that looks for the "_wwaction_" string. This means that the selected action/command will also be used to look up the view that the dispatcher forwards to. You may note that the form's action is also specified with the _wwaction_ syntax. This is because the submit buttons name/value is not always sent with the form if the user submitted using the enter key (in some browsers). The other reason for it is that there should be no performance loss for forms that do not use this feature. The implementation needs to search the parameters for one starting with _wwaction_, but will only do this if the form action starts with _wwaction_. I suggest we add this to the WW1.x code base. Any objections to this? Cheers, Dick Zetterberg [EMAIL PROTECTED] ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork