> -----Original Message----- > From: Robert Miller [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 19, 2004 12:25 PM > To: [EMAIL PROTECTED] > Subject: Conditionally Validating an Entire Form Based Upon the > buttonpressed > > > I have a form which has a "save" (<html:submit ...) and "continue" > (<html:cancel ...) button. > The "save" should validate and process the data in the form. > The "continue" button should go to the next page, skipping any > validation and processing. > > I have been using the validator plugin, with all of my validation in > the validation.xml file. > My form bean extends ValidatorForm and my validate function is > commented out (is not overriding the parent). > > This validates great but will not allow me to skip validation on > "continue". > > I have searched Google for conditional validation and only > found how to > conditionally validate "required" fields based upon the > values of other > fields. > > Any ideas or suggestions?
Yes, go ahead and override the validate method, checking which button was pressed, and then call super.validate() as usual. The framework does have a page component, so the validataion will only validate the pages submitted. > > The suggestion is good. But you might run into > > localization problems. The better approach is to > > extend the ValidatorLookupDispatchAction class by > > Brandon Goodin which extends the > > LookupDispatchAction. The buttons get their label > > texts from the properties files. > > If you are not thinking of localizing your > > application, you can determine which button was > > pressed and override the validate method of your > > action form. > > __________________________________ Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers! http://promotions.yahoo.com/new_mail --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]