Subject: Re: Multiple submit buttons solution
From: "Pim" <[EMAIL PROTECTED]>
 ===
Ok,

What I want is using multiple actionforms. The reason for this is because I
want to use different validations. I want no validation for create, I want a
validation for Save and I want a validation for say, fetch.Validations for
save and fetch are different.

What I don't want is one actionform with an if -then -else statement saying
if create, then do this, if save then do that. I want to have one superclass
with the properties of the jsp and the subclasses for different
actions(create, save, fetch).

So what we figured out was different mappings for the different actions
(create, save, fetch). The problem however is that the <html:form action =
'create'> can only contain one action of course. Our solution to that is
with the help of javascript we change the action.
For example if I press the fetch button, the action becomes one like this:
<html:form action = 'fetch' >

So, does this makes sense? Are we on the right track or are we missing
something?

Gr,

Pim

The problem is
"Ronald Haring" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> Ah no sorry, my mistake.
>
> It will all go to the same action form. I have created a field called
> action. A better name would have been navigation.
>
> In the action form I check this action/navigation field and then redirect
to
> the right page. But you can do this with multiple forms, e.g.
>
> <script>
> function go(form,navigate) {
> form.navigate.value=navigate;
> form.submit();
> }
> </script>
> <html:form action="/edit">
> <html:hidden name="navigate"/>
> </html:form>
> <html:form action="/delete">
> <html:hidden name="navigate"/>
> </html:form>
> <a href="javascript:go(document.forms[0], 'edit')">edit</a>)
> <a href="javascript:go(document.forms[1], 'del')">delete</a>)
>
> or even better
>
> <script>
> function go(form) {
> form.submit();
> }
> </script>
> <html:form action="/edit">
> <html:hidden name="navigate" value="edit"/>
> </html:form>
> <html:form action="/delete">
> <html:hidden name="navigate" value="del"/>
> </html:form>
> <a href="javascript:go(document.forms[0])">edit</a>)
> <a href="javascript:go(document.forms[1])">delete</a>)
>
> Gr
> Ronald
>
> > -----Original Message-----
> > From: Struts Newsgroup [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, March 06, 2002 11:40 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Multiple submit buttons solution
> >
> >
> > Subject: Re: Multiple submit buttons solution
> > From: "Pim" <[EMAIL PROTECTED]>
> >  ===
> > Hi Ronald,
> >
> > So what you actually do is adjusting the html:form action, right?
> >
> > Example:
> > <html:form action = "createregistration">
> >
> > And if I push the deletebutton -->
> > <a href=go('deleteregistration')><bean:message key="general.delete">
> >
> > This will change to:
> > <html:form action = "deleteregistration">
> >
> > Because this is what we figured out to do also..
> >
> > My question: How do you do that with the default submit buttons
> > (<html:submit >)?
> >
> > My guess is something like <html:submit onclick=
> > go('deleteregistration')> .
> > I'm a on the right track here?
> >
> > Tanx in advance,
> >
> > Pim
> >
> >
> >
> >
> >
> >
> >
> >
> > "Ronald Haring" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]...
> > > here is what I usually use, using links and submit
> > >
> > > <head>
> > > <javascript>
> > > function go(whatAction) {
> > > document.forms[0].action.value=whataction;
> > > document.forms[0].submit();
> > > }
> > > </script>
> > > </head>
> > > <body>
> > > <html:form>
> > > <input type=hidden .....>
> > > <html:hidden ...>
> > > <input type=text ....>
> > >
> > > f> <a href=go('edit')><bean:message key="general.delete"></a>&nbsp;
> > >
> > > </html:form>
> > >
> > > hope this helps
> > >
> > > Gr
> > > Ronald
> > >
> > > > -----Original Message-----
> > > > From: Peter Severin [mailto:[EMAIL PROTECTED]]
> > > > Sent: Wednesday, March 06, 2002 8:34 AM
> > > > To: keithBacon; struts-user
> > > > Subject: Re: Multiple submit buttons solution
> > > >
> > > >
> > > > Hi Keith,
> > > >
> > > > Yes you can use links but sometimes you need to submit the
> > > > form for each
> > > > action. I'll give you an example:
> > > > <form action="/updateTest.do">
> > > >     <input type="text" name="name">
> > > >
> > > >     <!-- <iterate> test questions. one row per question.
> > I omit the
> > > > table tags for simplicity-->
> > > >     Question name
> > > >     Question text
> > > >     <input type="submit" name="questionId_10" value="Delete">
> > > >     <!-- </iterate>
> > > > </form>
> > > >
> > > > So basically you have a form with some fields and a list
> > which also
> > > > makes part from the form. If you change the test name
> > from the example
> > > > above and then click Delete button on one of the questions
> > > > the form will
> > > > be submitted and you will not lose the changes you have made
> > > > to the test
> > > > name. But you will lose this changes if you use links.
> > > > Regarding buttons
> > > > ugliness - I agree, but you could use some images of smaller size
> > > > instead of buttons.
> > > >
> > > > Hope it was clear.
> > > >
> > > > Regards,
> > > > Peter.
> > > >
> > > > --- Peter Severin <[EMAIL PROTECTED]> wrote:
> > > > Hi Peter,
> > > > I just use links to do this. (I think you can use an
> > Image as well).
> > > > Buttons are a bit ugly so I don't need this functionality.
> > > > There's lots in struts so I don't favor adding more.
> > > > Keith.
> > > >
> > >
> > >
> > > Furore B.V.
> > > Rijswijkstraat 175-8
> > > Postbus 9204
> > > 1006 AE Amsterdam
> > > tel. (020) 346 71 71
> > > fax. (020) 346 71 77
> > >
> > >
> > --------------------------------------------------------------
> > ------------
> > --
> > > ---------------
> > > The information transmitted is intended only for the person
> > > or entity to which it is addressed and may contain confidential
> > > and/or privileged material. Any review, retransmission,
> > > dissemination or other use of, or taking of any action in
> > > reliance upon, this information by persons or entities other
> > > than the intended recipient is prohibited. If you received
> > > this in error, please contact the sender and delete the material
> > > from any computer
> > >
> > --------------------------------------------------------------
> > ------------
> > --
> > > ---------------
> > >
> > >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
> Furore B.V.
> Rijswijkstraat 175-8
> Postbus 9204
> 1006 AE Amsterdam
> tel. (020) 346 71 71
> fax. (020) 346 71 77
>
> --------------------------------------------------------------------------
--
> ---------------
> The information transmitted is intended only for the person
> or entity to which it is addressed and may contain confidential
> and/or privileged material. Any review, retransmission,
> dissemination or other use of, or taking of any action in
> reliance upon, this information by persons or entities other
> than the intended recipient is prohibited. If you received
> this in error, please contact the sender and delete the material
> from any computer
> --------------------------------------------------------------------------
--
> ---------------
>
>



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

Reply via email to