Hi Ross, Would this be of use to you?
@ValidationMethod(on="division") public void avoidDivideByZero(ValidationErrors errors) { String skip = getContext().getRequest().getParameter("skip"); if( skip != null && !"".equals(skip) ) { return; //do not validate } if (this.numberTwo == 0) { errors.add("numberTwo", new SimpleError("/ by zero not allowed.") ); } } Cheers, DJDaveMark > ---------------------------------------------------------------------- > Date: Tue, 10 Jun 2008 13:49:48 -0400 > From: "Ross Sargant" <[EMAIL PROTECTED]> > Subject: Conditional Validation > To: Stripes-users@lists.sourceforge.net > > Hi, > Is it possible to have validation in stripes run conditionally based on > other request parameters? > > My scenario is that I have a search form with several different search > options. > Each search option has a checkbox which activates that criteria for the > search and a corresponding input control (either a text-box or drop-down) > for the criteria value. > > Is there a way, without writing much code myself ,to have stripes handle the > validation of the free-form text entry ONLY when the corresponding check-box > is selected? > I looked at DontValidate and the "on" annotation but neither seems like it > would fit the bill here. I know I can write my own code to run stripes > validators based on the checkbox state but obviously I'd like to avoid that. > > This seems like a pretty common way of building a search form with different > options so I'm suprised I'm having difficulty with it. > > Is there something I've missed here that would make this easier? Another way > of setting up the page controls perhaps? > > Thanks, > > -- > Ross Sargant > > TVR Communications LLC > Software Engineer > 3275 W Hillsboro Blvd,Suite 300,Deerfield Beach, Florida,33442 > > http://www.tvrc.com _ _ __________________________________________________________ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users