You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Joe Faith <fa...@runtime-collective.com> on 2001/11/15 11:08:00 UTC

Re: [SUBMIT] LookupDispatchAction - how to handle multiple html:submit buttons

We have also implemented a multiple submit button system; but in our
case we wrote a custom tag that generates javascript that sets a property
to a specified value and submits the form when you hit the button.

The tags look something like:

    <my_submit property="formAction" value="delete" label="Delete this
record"/>
    <my_submit property="formAction" value="save" label="Save changes"/>
    <my_submit property="formAction" value="copy" label="Copy this record"/>

etc

A single action object can then use the value of formAction to decide what to
do in each case.
This has the side-effect of reducing the number of Action classes needed.

However, the tags generate javascript and I wasn't sure if this fitted the
struts philosophy; so I
haven't submitted the code changes. But if anyone was interested I could make
it available.

Joe Faith

Runtime Collective, Ltd
T: (+44) 01273 234294

Erik Hatcher wrote:

> As promised earlier today, here is my contribution to the multiple
> html:submit button saga (Ted, time to update your FAQ! :)....

Re: [SUBMIT] LookupDispatchAction - how to handle multiple html:submit buttons

Posted by Ted Husted <hu...@apache.org>.
Most of us would not rely *solely* on Javascript for validation, since
it can be turned off, and therefor endanger your application. But
requiring it to handle multiple buttons is a different matter, so long
as the default formAction did nothing harmful if Javascript were turned
off. 

The ValidatorForm in the contrib folder generates *lots* of Javascript.
The html:form tag also generates a Javascript to move the focus, as do
some others. So, I don't see anything wrong with a tag that generated
Javascript for setting a property. Heck, I'm doing by hand myself ;-)

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel +1 716 737-3463
-- http://www.husted.com/struts/


Joe Faith wrote:
> 
> We have also implemented a multiple submit button system; but in our
> case we wrote a custom tag that generates javascript that sets a property
> to a specified value and submits the form when you hit the button.
> 
> The tags look something like:
> 
>     <my_submit property="formAction" value="delete" label="Delete this
> record"/>
>     <my_submit property="formAction" value="save" label="Save changes"/>
>     <my_submit property="formAction" value="copy" label="Copy this record"/>
> 
> etc
> 
> A single action object can then use the value of formAction to decide what to
> do in each case.
> This has the side-effect of reducing the number of Action classes needed.
> 
> However, the tags generate javascript and I wasn't sure if this fitted the
> struts philosophy; so I
> haven't submitted the code changes. But if anyone was interested I could make
> it available.
> 
> Joe Faith
> 
> Runtime Collective, Ltd
> T: (+44) 01273 234294

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


Re: [SUBMIT] LookupDispatchAction - how to handle multiple html:submit buttons

Posted by Joe Faith <fa...@runtime-collective.com>.
Here's the code and the .tld.

At the moment the SubmitTag class is in our own package
(com.RuntimeCollective.struts)
but it would be trivial to move it.

(I didn't integrate it into the struts:html tag library, cos I wasn't sure if
it was appropriate)

Joe Faith
http://www.runtime-collective.com
T: (+44) 01273 234294
M: (+44) 07968 292064

Andy Noble wrote:

> Hi Joe,
>
> I would certainly be interested in your code for this tag, as I have decided
> to make javascript a prerequisite for my project.
>
> Regards
> Andy
>
> ----- Original Message -----
> From: Joe Faith <fa...@runtime-collective.com>
> To: Struts Developers List <st...@jakarta.apache.org>
> Sent: Thursday, November 15, 2001 10:08 AM
> Subject: Re: [SUBMIT] LookupDispatchAction - how to handle multiple
> html:submit buttons
>
> > We have also implemented a multiple submit button system; but in our
> > case we wrote a custom tag that generates javascript that sets a property
> > to a specified value and submits the form when you hit the button.
> >
> > The tags look something like:
> >
> >     <my_submit property="formAction" value="delete" label="Delete this
> > record"/>
> >     <my_submit property="formAction" value="save" label="Save changes"/>
> >     <my_submit property="formAction" value="copy" label="Copy this
> record"/>
> >
> > etc
> >
> > A single action object can then use the value of formAction to decide what
> to
> > do in each case.
> > This has the side-effect of reducing the number of Action classes needed.
> >
> > However, the tags generate javascript and I wasn't sure if this fitted the
> > struts philosophy; so I
> > haven't submitted the code changes. But if anyone was interested I could
> make
> > it available.
> >
> > Joe Faith
> >
> > Runtime Collective, Ltd
> > T: (+44) 01273 234294
> >
> > Erik Hatcher wrote:
> >
> > > As promised earlier today, here is my contribution to the multiple
> > > html:submit button saga (Ted, time to update your FAQ! :)....
> >
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

Re: [SUBMIT] LookupDispatchAction - how to handle multiple html:submit buttons

Posted by Andy Noble <an...@data-workshop.com>.
Hi Joe,

I would certainly be interested in your code for this tag, as I have decided
to make javascript a prerequisite for my project.

Regards
Andy

----- Original Message -----
From: Joe Faith <fa...@runtime-collective.com>
To: Struts Developers List <st...@jakarta.apache.org>
Sent: Thursday, November 15, 2001 10:08 AM
Subject: Re: [SUBMIT] LookupDispatchAction - how to handle multiple
html:submit buttons


> We have also implemented a multiple submit button system; but in our
> case we wrote a custom tag that generates javascript that sets a property
> to a specified value and submits the form when you hit the button.
>
> The tags look something like:
>
>     <my_submit property="formAction" value="delete" label="Delete this
> record"/>
>     <my_submit property="formAction" value="save" label="Save changes"/>
>     <my_submit property="formAction" value="copy" label="Copy this
record"/>
>
> etc
>
> A single action object can then use the value of formAction to decide what
to
> do in each case.
> This has the side-effect of reducing the number of Action classes needed.
>
> However, the tags generate javascript and I wasn't sure if this fitted the
> struts philosophy; so I
> haven't submitted the code changes. But if anyone was interested I could
make
> it available.
>
> Joe Faith
>
> Runtime Collective, Ltd
> T: (+44) 01273 234294
>
> Erik Hatcher wrote:
>
> > As promised earlier today, here is my contribution to the multiple
> > html:submit button saga (Ted, time to update your FAQ! :)....
>


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