You can't use booleans in the depends, but there can
be dependencies setup between validation routines. 
You can make a method check pluggable validator and
have required and other validator depend on it. 
Although the default configuration has everything
depend on required so if required depends on something
else, everything should work fine.  Method would be
checked first and then if it passes required would be
next.

<validator name="method"
   classname="MyDispatchMethodChecker"
   method="validateDispatchMethod"
methodParams="java.lang.Object,org.apache.commons.validator.ValidatorAction,org.apache.commons.validator.Field,org.apache.struts.action.ActionErrors,javax.servlet.http.HttpServletRequest"
   msg="errors.method"/>

<validator name="required"
   classname="org.apache.struts.util.StrutsValidator"
   method="validateRequired"
methodParams="java.lang.Object,org.apache.commons.validator.ValidatorAction,org.apache.commons.validator.Field,org.apache.struts.action.ActionErrors,javax.servlet.http.HttpServletRequest"
   depends="method"
   msg="errors.required"/>

David

--- William W <[EMAIL PROTECTED]> wrote:
> 
> Is it possible ?
> Use boolean in the "depends" property ?
> 
> <field property="password"
>        depends="method OR required">
>           <arg0
> key="typeForm.password.displayname"/>
>           <var>
>              <var-name>methodName</var-name>
>              <var-value>update</var-value>
>           </var>
> </field>
> 
> 
> >From: "William W" <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List"
> <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >Subject: Re: Validator and DispatchAction
> >Date: Thu, 13 Jun 2002 14:46:09 +0000
> >
> >
> >I think that if I use DispatchAction with
> ValidatorActionForm I will have 
> >the same problem. How can I validate the form for
> diferents methods in the 
> >same Action ? Am I wrong ?
> >Thanks,
> >William.
> >
> >
> >>From: David Winterfeldt <[EMAIL PROTECTED]>
> >>Reply-To: "Struts Users Mailing List"
> <[EMAIL PROTECTED]>
> >>To: Struts Users Mailing List
> <[EMAIL PROTECTED]>,  Rick 
> >>Reumann <[EMAIL PROTECTED]>
> >>Subject: Re: Validator and DispatchAction
> >>Date: Wed, 12 Jun 2002 14:42:51 -0700 (PDT)
> >>
> >>You would currently have to write your own
> required
> >>validation method and have it check a variable
> defined
> >>by a field to see if it should perform the
> validation
> >>or not.  Or define a separate set of validation
> rules
> >>for each action and use ValidatorActionForm (which
> >>uses the action path to retrieve the validation
> >>rules).
> >>
> >>David
> >>
> >>--- Rick Reumann <[EMAIL PROTECTED]> wrote:
> >> > On Wednesday, June 12, 2002, 10:14:09 AM,
> William
> >> > wrote:
> >> >
> >> > WW> I have a UserForm, the fields are : userId
> and
> >> > userName.
> >> > WW> I have a UserAction that extends
> DispatchAction.
> >> > The UserAction have  two
> >> > WW> methods (insert and update). For the insert
> >> > method only the userName is
> >> > WW> required, and for update method the userId
> and
> >> > the userName are required.
> >> > WW> How can I can do a dependency validation
> with
> >> > the validator.xml ?
> >> >
> >> >     I'm curious about this as well. There was a
> post
> >> > a few days back
> >> >     dealing with the same issue. I think you
> are
> >> > able to nest
> >> >     validation rules for a form but I forgot
> the
> >> > exact syntax. Maybe
> >> >     someone else could shed some light again on
> how
> >> > to do this.
> >> >
> >> >
> >> > --
> >> >
> >> > Rick
> >> > mailto:[EMAIL PROTECTED]
> >> >
> >> > "If you go to a party, and you want to be the
> >> > popular one at the
> >> > party, do this: Wait until no one is looking,
> then
> >> > kick a burning log
> >> > out of the fireplace onto the carpet. Then jump
> on
> >> > top of it with your
> >> > body and yell, "Log o' fire! Log o' fire!" I've
> >> > never done this, but I
> >> > think it'd work."
> >> >   -Jack Handey
> >> >
> >> >
> >> > --
> >> > To unsubscribe, e-mail:
> >> >
> <mailto:[EMAIL PROTECTED]>
> >> > For additional commands, e-mail:
> >> > <mailto:[EMAIL PROTECTED]>
> >> >
> >>
> >>
> >>__________________________________________________
> >>Do You Yahoo!?
> >>LAUNCH - Your Yahoo! Music Experience
> >>http://launch.yahoo.com
> >>
> >>--
> >>To unsubscribe, e-mail:   
>
>><mailto:[EMAIL PROTECTED]>
> >>For additional commands, e-mail: 
> >><mailto:[EMAIL PROTECTED]>
> >
> >
> >
> >
>
>_________________________________________________________________
> >MSN Photos is the easiest way to share and print
> your photos: 
> >http://photos.msn.com/support/worldwide.aspx
> >
> >
> >--
> >To unsubscribe, e-mail:   
> ><mailto:[EMAIL PROTECTED]>
> >For additional commands, e-mail: 
> ><mailto:[EMAIL PROTECTED]>
> 
> 
> 
> 
>
_________________________________________________________________
> Join the world’s largest e-mail service with MSN
> Hotmail. 
> http://www.hotmail.com
> 
> 
> --
> To unsubscribe, e-mail:  
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 


__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to