Just wondering Laurie ... why cant I use other "validation rules" along with validwhen? I dont see any fundamental reason why I need to resort to regular expressions when I use validwhen tag. For example, it would be great if I could say .. validwhen (some test) .. use the date validation!
Is there something inherent in the way it is designed that this is not possible? Regards, Raghu On 12/6/05, Laurie Harper <[EMAIL PROTECTED]> wrote: > > I was going to say 'yes, you can do that,' but I don't think you can > express field length constraints with validwhen unfortunately :-( > > L. > > Deepa Khetan wrote: > > Actually, i need to implement a if{} else{} condition in validation > > framework.. > > if(field1=='usr1'){ > > <field > > property="password" > > depends="minlength,maxlength"> > > > > <var> > > <var-name>minlength</var-name> > > <var-value>8</var-value> > > </var> > > > > <var> > > <var-name>maxlength</var-name> > > <var-value>14</var-value> > > </var> > > </field> > > > > }else{ > > <field > > property="password" > > depends="minlength,maxlength"> > > > > <var> > > <var-name>minlength</var-name> > > <var-value>6</var-value> > > </var> > > > > <var> > > <var-name>maxlength</var-name> > > <var-value>11</var-value> > > </var> > > </field> > > } > > > > > > Something of the above sort... Can i do that with the frmework or do i > need > > to write my own javascript?? > > Regards, > > Deepa > > > > On 12/5/05, Laurie Harper <[EMAIL PROTECTED]> wrote: > >> Wendy Smoak wrote: > >>> On 12/4/05, Deepa Khetan <[EMAIL PROTECTED] > wrote: > >>>> I need sme help with validator framework.. I have a LogonForm which > is > >> being > >>>> mapped with 2 different JSPs. Both the JSPs have the password field, > >> but the > >>>> validation for the field are diferent(The minlength and maxlength for > >> both > >>>> the pages is different). On the basis of the value of some other > >> field(say, > >>>> field1) i need to validate the pasword field. How can i do this?? > >>> You can use one of the form bean types with 'Action' in the name, such > >>> as ValidatorActionForm. > >>> > http://struts.apache.org/struts-doc-1.2.7/api/org/apache/struts/validator/ValidatorActionForm.html > >>> These are mapped by path instead of form bean name, so you can have a > >>> different set of rules for each action mapping. > >>> > >>> In validation.xml, you might have: > >>> <form name="/register"> > >>> which matches up with (from struts-config.xml) > >>> <action path="/register" ... > > >>> > >>> HTH, > >>> -- > >>> Wendy > >> The other thing you might want to look at is the 'validwhen' rule [1], > >> if you want to base your validation criteria on the value of field1 > >> rather than on the action mapping path. > >> > >> L. > >> > >> [1] > >> > >> > http://struts.apache.org/struts-doc-1.2.7/userGuide/dev_validator.html#validwhen > >> > >> > >> --------------------------------------------------------------------- > >> 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] > >