Hi Larry,

This exactly the situation my solution would help. Eeach submit button would
have a different name but this would be transparently handled by struts. E.g.:
<input type="submit" name="action_save" value="Save">
<input type="submit" name="action_saveAs" value="Save As">

Convention would be that underscore(or any other char)  is parameter name/value
separator. So the parameter name 'action_save' would be transformed into
action=save. In the action form I would have a field named 'action' which would
take the value 'save' or 'saveAs' .

Regards,
Peter.

"Maturo, Larry" wrote:

> Hi Peter,
>
> Yes, indexed won't help with this situation, since
> it only works within an iterate tag.  The submit
> button doesn't have anything to help you in this
> situation, as far as I can tell.  The only thing
> I can think of is using value attributes like
> "Edit 1", "Edit 2", etc., but of course, the
> users would these as the buttons label, which
> would be ugly.
>
> -- Larry
>
> -----Original Message-----
> From: Peter Severin [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, March 06, 2002 2:55 AM
> To: Maturo, Larry
> Subject: Re: Multiple submit buttons solution
>
> Hi Larry,
>
> Though I think indexed properties solve the problem with tables with submit
> in each row what happens when I simply want to have five different submit
> buttons in the form ? Sure I can give each button a different name but this
> results in five different member variables in the action form. It would be
> more clean to have a single field which value would be checked in the
> action.
>
> Regards,
> Peter.
>
> "Maturo, Larry" wrote:
>
> > Hi Peter,
> >
> > I haven't played with images, so I can't really
> > answer your question, but it would be worth a try
> > to see if it will work.  In Struts you end up
> > doing a lot of experimenting.
> >
> > -- Larry
> >
> > -----Original Message-----
> > From: Peter Severin [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, March 05, 2002 10:32 AM
> > To: Maturo, Larry
> > Subject: Re: Multiple submit buttons solution
> >
> > Hi Mauro,
> >
> > Thanks for your reply. It seems to solve the problem I have.
> > It seems I have been missing the latest struts trends. Though one which
> > problem
> > remains is internationalized submit button value. But it can be worked
> > around doing
> > null/not null check. Does this feature also works for image submits ? Can
> > be image submits be replaced with regular buttons without any code change
> > ?
> >
> > Thanks,
> > Peter.
> >
> > "Maturo, Larry" wrote:
> >
> > > Hi Peter,
> > >
> > > Are you trying to have a table with one or more buttons
> > > in each row?  If so, check out the Struts white paper
> > > at http://stealthis.athensgroup.com/presentations/, under
> > > the Model Layer Framework and look at the section
> > > on use of the indexed attribute under logic:iterate for
> > > example of how to do this.  I've evidently missed a
> > > previous post in this thread, but I don't know what
> > > problem you are trying to solve.
> > >
> > > -- Larry Maturo
> > >
> > > -----Original Message-----
> > > From: Peter Severin [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, March 05, 2002 9:11 AM
> > > To: [EMAIL PROTECTED]
> > > 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:
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > >


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to