Hi Erik, Actually after some reasoning about the application I came to a conclusion that I will not use the integration between Struts and the Validator framework. I might still use the ready made validators, but I will call them explicitly.
The reason is, the pages in the application are designed to do search, add, edit and delete functionalities in the same page. We do this using the same form, and the button the user presses is what determines the operation. This makes all the validations kind of conditional. For example, the id will be mandatory if you're deleting but the name will be mandatory if you're adding and so on. As a result, to support this, I will have to declare all my required validations using requiredif since usually most validations depend on required. Since requiredif does not have a clientside script part, that means I will only benefit from server side validation, that's problem number one. Problem number two is that declaring all required validations as requiredif will be very time consuming, since the syntax for requiredif is a bit awkward and very verbose. Adding the fact that requiredif is not supported in the version I'm using makes the integration almost meaningless. As you see, no clientside, time consuming simple validations and above all, it's not currently working. That led me to the decision to just write my own validation code in the validate method. The only thing that would make me change my mind is if I were able to use validwhen with 1.1b2. Only then will this make sense, although even in this case I would still have to write my own clientside validations. Or wouldn't I? Depends on whether validwhen generates javascript for clientside validation. Does it do that? And do you think this is possible? Thanks -----Original Message----- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 19, 2005 7:54 PM To: Struts Users Mailing List Subject: Re: requiredif Oh, I'm sorry. I pulled that from the last release of 1.1. Zoinks, you are stuck with a pre-1.1 version? Perhaps you could write a custom validator plugin that basically does the same thing? tarek.nabil wrote: > Hi Erik, > >I tried it and it didn't work. I checked out the validator and struts >jar files and it turned out that the >org.apache.struts.validator.FieldChecks class does not exist in either >of them. Is it possible that it was introduced after 1.1b2? I'm sure >it's in RC1 because I'm using the documentation shipped in 1.1RC1. > >Thanks again for your help. > >-----Original Message----- >From: tarek.nabil >Sent: Tuesday, April 19, 2005 7:41 PM >To: Struts Users Mailing List >Subject: RE: requiredif > >Thanks Erik. > >I was wondering, is there a client side JavaScript part? > >Also, is it possible to use validwhen with the old versions of struts >(1.1b2). > >Thanks for your help. > >-----Original Message----- >From: Erik Weber [mailto:[EMAIL PROTECTED] >Sent: Tuesday, April 19, 2005 3:24 PM >To: Struts Users Mailing List >Subject: Re: requiredif > > > <!-- requiredif --> > <validator name="requiredif" > classname="org.apache.struts.validator.FieldChecks" > method="validateRequiredIf" > methodParams="java.lang.Object, > >org.apache.commons.validator.ValidatorAction, > org.apache.commons.validator.Field, > org.apache.struts.action.ActionErrors, > org.apache.commons.validator.Validator, > javax.servlet.http.HttpServletRequest" > msg="errors.required"/> > > >Erik > > >tarek.nabil wrote: > > > >>Hi, >> >>I'm stuck with Struts 1.1b2 and I need to do some conditional >>validation. AFAIK, the way to do this for this version is using the >>requiredif validator. The problem is, I cannot find any reference >>information on how to add this validator to the validator-rules.xml >>configuration file. >> >>Please advise on how to do this and if there's a better way to do this >>with this old version. For example, is it possible to configure the >>old >> >> > > > >>Struts/Validator versions to use validwhen? >> >>Any help is appreciated. >> >>Tarek Nabil >> >> >>--------------------------------------------------------------------- >>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] > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]