You either do conditional validations, implement custom validators, or as Lukasz suggested write your own validate() method. When validation is very complex the last may be the best options.
Dave --- On Wed, 6/25/08, Istvan Kozma <[EMAIL PROTECTED]> wrote: > How the validation should be done for fields which are only > displayed in certain conditions? If I do this through the > XML file the validation is done all the time even when the > field is not visible. > > Istvan > > > ----- Original Message ---- > From: Dave Newton <[EMAIL PROTECTED]> > To: Struts Users Mailing List > <user@struts.apache.org> > Sent: Wednesday, June 25, 2008 3:37:38 PM > Subject: Re: validation problem > > Whoops, as the other reply said, it's the > <s:fielderror...> tag [1], not <s:actionerror>. > > Dave > > [1] http://struts.apache.org/2.x/docs/fielderror.html > > --- On Wed, 6/25/08, Dave Newton > <[EMAIL PROTECTED]> wrote: > > --- On Wed, 6/25/08, Anshu Dhamija wrote: > > > i am facing problem in performing validation > through > > > xml actually i want to display message at the top > of > > > my form instaed of at field level > > > can anyone please help me > > > > The validation messages are placed in the form by the > S2 > > form element tags. If you want to modify the output of > > those tags you can modify or create a theme [1]. > > > > Using the "simple" theme will also remove > the > > validation messages, but you'll lose other useful > > functionality--but that might not be an issue > depending on > > your usecase. > > > > The <s:actionerror...> tag [2] will render any > error > > messages. A combination of either the simple theme or > a > > modified theme plus the action error tag may do what > you > > need. > > > > Dave > > > > [1] > > > http://struts.apache.org/2.x/docs/themes-and-templates.html > > [2] http://struts.apache.org/2.x/docs/actionerror.html > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]