You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Olivier Dinocourt <ol...@anpe.fr> on 2002/03/05 16:10:05 UTC

Re: Multiple submit buttons solution

why not use :
<input type="submit" name="edit" value="10">
or
<input type="submit" name="delete" value="10">

olivier

----- Original Message -----
From: "Peter Severin" <pp...@architekt.ro>
To: <st...@jakarta.apache.org>
Sent: Tuesday, March 05, 2002 4:10 PM
Subject: Multiple submit buttons solution


> Hi folks,
>
> I've been searching for a solution for multple submit buttons in the
> same form
> and how it can be achieved without using javascript. Summing up
> different suggesstions
> I came with the following solution. We can encode additional parameter
> values into the submit button name and make struts handle this
> parameters transparently for us.
> For example we could have the following html code:
> <input type="submit" name="deleteItemId_10" value="Delete">
>
> ActionServlet would detect this parameter and auto populate the form
> with parameter 'deleteItemId' and value '10'.
> To extend this idea further we could have the following code:
>
> <input type="submit" name="action_delete_itemId_10" value="Delete">
> <input type="submit" name="action_edit_itemId_10" value="Edit">
>
> In the action we could test form.getAction() parameter value and to
> dispatch to the coresponding delete/edit method inside which we coule
> use form.getItemId() to execute the operation.
> You've got the point.
> I would like to hear comments and suggestions on this. I am willing to
> post the actual code in the future if the idea proves itself valuable.
>
> Regards,
> Peter.
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>