struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Moore <j...@jmsd.co.uk>
Subject Re: Newbie question: How to implement conditional validation in an ActionForm?
Date Thu, 13 May 2004 16:33:28 GMT
Adam Lipscombe wrote:

> 
>I have implemented  a wizard framework. Each JSP page uses the same
>ActionForm, passing a hidden property "pageNumber" to control which
>validation  is applied. As the wizard progresses the ActionForm data is
>built up.
>This works well as long as the user presses "next" or finish".
> 
>However if the user presses "cancel"  the ActionForm.validate() method is
>called and the wizard page is re-displayed with any errors.
>If the cancel is pressed I just want to exit the wizard without calling the
>ActionForm.validate() method.Or at least be able to detect that the cancel
>button was pressed within the ActionForm.validate() method.
> 
> 
>Apologies if this is obvious. Any ideas?
> 
> 
>  
>
Where are you doing your validation? I've done something similar (a 
wizard) and I'm doing the validation within the Action class. I test for 
which submit button has been pressed (i.e., what the text of the 
'submit' parameter is) and act accordingly. You could certainly test for 
Cancel there and bypass the validation.

John

-- 
==============================================
John Moore  -  Norwich, UK  -  john@jmsd.co.uk
==============================================

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


Mime
View raw message