You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sandro Giessl <sg...@gmail.com> on 2007/08/17 12:37:46 UTC

[S2] Validation depending on which submit button was pressed

Hi,

I have one form which submits data to one action. However there are different 
s:submit-buttons in the form (Add Row, Back, Forward).
Full validation should only happen if "Forward" has been clicked. The other 
buttons should only validate some non-required field formats 
(Int-Validator, ...).

What's the preferred way to do this? Is there a way to select a struts action 
depending on which button has been pressed?

Thank you very much.

Regards, Sandro

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [S2] Validation depending on which submit button was pressed

Posted by Sandro Giessl <sg...@gmail.com>.
Hi!

method="..." is exactly what I have been looking for. Sorry for disturbing the 
list, I didn't expect it to be that easy. :)

Thanks!

Sandro

On Friday 17 August 2007 14:22:57 j alex wrote:
> Assuming that Add, Back , Fwd are different methods in the same
> Action, you could use s:submit method="Add" to post to Add method, and
> define the validations for that method using annotation . I havent
> tried if the non-field level validators get executed at this point
>
> On 8/17/07, Sandro Giessl <sg...@gmail.com> wrote:
> > Hi,
> >
> > I have one form which submits data to one action. However there are
> > different s:submit-buttons in the form (Add Row, Back, Forward).
> > Full validation should only happen if "Forward" has been clicked. The
> > other buttons should only validate some non-required field formats
> > (Int-Validator, ...).
> >
> > What's the preferred way to do this? Is there a way to select a struts
> > action depending on which button has been pressed?
> >
> > Thank you very much.
> >
> > Regards, Sandro
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [S2] Validation depending on which submit button was pressed

Posted by Sandro Giessl <sg...@gmail.com>.
Hi!

method="..." is exactly what I have been looking for. Sorry for disturbing the 
list, I didn't expect it to be that easy. :)

Thanks!

Sandro

On Friday 17 August 2007 14:22:57 j alex wrote:
> Assuming that Add, Back , Fwd are different methods in the same
> Action, you could use s:submit method="Add" to post to Add method, and
> define the validations for that method using annotation . I havent
> tried if the non-field level validators get executed at this point
>
> On 8/17/07, Sandro Giessl <sg...@gmail.com> wrote:
> > Hi,
> >
> > I have one form which submits data to one action. However there are
> > different s:submit-buttons in the form (Add Row, Back, Forward).
> > Full validation should only happen if "Forward" has been clicked. The
> > other buttons should only validate some non-required field formats
> > (Int-Validator, ...).
> >
> > What's the preferred way to do this? Is there a way to select a struts
> > action depending on which button has been pressed?
> >
> > Thank you very much.
> >
> > Regards, Sandro
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [S2] Validation depending on which submit button was pressed

Posted by j alex <st...@gmail.com>.
Assuming that Add, Back , Fwd are different methods in the same
Action, you could use s:submit method="Add" to post to Add method, and
define the validations for that method using annotation . I havent
tried if the non-field level validators get executed at this point



On 8/17/07, Sandro Giessl <sg...@gmail.com> wrote:
> Hi,
>
> I have one form which submits data to one action. However there are different
> s:submit-buttons in the form (Add Row, Back, Forward).
> Full validation should only happen if "Forward" has been clicked. The other
> buttons should only validate some non-required field formats
> (Int-Validator, ...).
>
> What's the preferred way to do this? Is there a way to select a struts action
> depending on which button has been pressed?
>
> Thank you very much.
>
> Regards, Sandro
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org