I prefer to use onSuccess method and handle second level validation in onValidate and onValidateFromXxx method. I use @Validate for first level validation, and sometime create my own validator when it's possible.
Regards, Christophe. 2009/10/21 Newham, Cameron <cameron.new...@bl.uk> > Apologies if this is obvious, but I'm getting confused over how and > where onValidateForm() should be used. I have a page with search fields > in a form and also a grid for the results. > > > > Currently I have: > > > > public void onValidateForm() > > { > > if (title == null && issn == null) > > { > > searchHoldingsForm.recordError("Please provide a value > for Title or ISSN"); > > } > > } > > > > public void onSubmitFromSearchHoldingsForm() > > { > > // perform database access using the form fields... > > ... > > > > > > However, the onSubmit...() will be called even if there is an error. Ok, > I could use a Boolean and set it in onValidate() and then bail out in > onSubmit...() if there is an error. Or I suppose I could dispense with > onValidateForm() altogether and set the error messages directly in > onSubmit...() Or perhaps I should keep onValidateForm() and do the DB > stuff in onSuccess()? > > > > What is the correct way to proceed and why? > > > > > > > > > >