Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 9579 invoked from network); 13 May 2004 16:35:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 13 May 2004 16:35:58 -0000 Received: (qmail 16741 invoked by uid 500); 13 May 2004 16:35:07 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 16701 invoked by uid 500); 13 May 2004 16:35:07 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 16668 invoked by uid 98); 13 May 2004 16:35:07 -0000 Received: from john@jmsd.co.uk by hermes.apache.org by uid 82 with qmail-scanner-1.20 (clamuko: 0.70. Clear:RC:0(195.112.4.54):. Processed in 0.231159 secs); 13 May 2004 16:35:07 -0000 X-Qmail-Scanner-Mail-From: john@jmsd.co.uk via hermes.apache.org X-Qmail-Scanner: 1.20 (Clear:RC:0(195.112.4.54):. Processed in 0.231159 secs) Received: from unknown (HELO smtp.nildram.co.uk) (195.112.4.54) by hermes.apache.org with SMTP; 13 May 2004 16:35:06 -0000 Received: from jmsd.co.uk (jonmor.gotadsl.co.uk [213.208.123.172]) by smtp.nildram.co.uk (Postfix) with ESMTP id C3B7B255C01 for ; Thu, 13 May 2004 17:34:42 +0100 (BST) Message-ID: <40A3A358.9090503@jmsd.co.uk> Date: Thu, 13 May 2004 17:33:28 +0100 From: John Moore Reply-To: john@jmsd.co.uk User-Agent: Mozilla Thunderbird 0.5 (X11/20040229) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Struts Users Mailing List Subject: Re: Newbie question: How to implement conditional validation in an ActionForm? References: <000001c43906$c1cd9800$0401a8c0@cobar> In-Reply-To: <000001c43906$c1cd9800$0401a8c0@cobar> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: hermes.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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