Hi Kevin, Thanks for the reply. I'm a little confused by your example though. First off - what does the ${4dig} mean? This won't validate a checkbox, right?
Second, you have a lot of stuff commented out. Are these fields getting validated? Finally, if I wanted to just test against a boolean being checked would I do something like the following? <field property="prop1" depends="mask"> <msg name="requiredif" key="app224Form.aForm.prop1.req"/> <msg name="mask" key="app224Form.aForm.prop1.mask"/> <var> <var-name>mask</var-name> <var-value>${4dig}</var-value> </var> <var> <var-name>field-checked[0]</var-name> <var-value>true</var-value> </var> I'm quite confused! Sorry, Thanks, Brian -----Original Message----- From: Kevin Robair [mailto:[EMAIL PROTECTED] Sent: 26 June 2003 14:30 To: Struts Users Mailing List Subject: Re: requiredif - simple example The following worked for me. Note that in RC1, the <var-name> tag values are expected to be field-test[n], not fieldTest[n] and so on.... The requiredif check was removed because in 1.1RC1, requiredif would break a javascript validator such as mask. I used custom validation instead. <field property="prop1" depends="mask"><!-- removed requiredif --> <msg name="requiredif" key="app224Form.aForm.prop1.req"/> <msg name="mask" key="app224Form.aForm.prop1.mask"/> <var> <var-name>mask</var-name> <var-value>${4dig}</var-value> </var> <!-- <var> <var-name>field[0]</var-name> <var-value>feeExempt</var-value> </var> <var> <var-name>fieldTest[0]</var-name> <var-value>EQUAL</var-value> </var> <var> <var-name>fieldValue[0]</var-name> <var-value>true</var-value> </var> <var> <var-name>field[1]</var-name> <var-value>prop1</var-value> </var> <var> <var-name>fieldTest[1]</var-name> <var-value>NULL</var-value> </var> --> You can also check out the Validator doc on the struts documentation. Just expand the struts-documentation webapp that comes with your version of struts, it is under User and Developer Guides. -Kevin --- Brian McSweeney <[EMAIL PROTECTED]> wrote: > Hi all, > > The validator package works well for me. > But I'm trying to use the requiredif and failing. > > I know there has been previous discussion of this, > but I'm trying to a simple validation based on a checkbox > so perhaps someone could tell me where I'm going wrong. > > For example, > > I want to validate a creditcard, if a checkbox is checked. > > I currently am trying to do this as follows: > > > <form name="myForm"> > <field property="creditCard" > depends="requiredif,creditCard"> > > <arg0 key="myForm.creditCard"/> > <arg0 > name="creditCard" > key="CreditCard" > resource="false" > /> > <arg0 > name="requiredif" > key="A Credit-Card is" > resource="false" > /> > <var> > <var-name>myForm.checked</var-name> > <var-value>on</var-value> > </var> > </field> > </form> > > > The form name is: myForm > > The creditcard field is named "creditCard" > The checkbox field is named "checked" > > Note that all other types of validation are working correctly for me. > > Any help would be SO much appreciated. > Brian > --------------------------------------------------------------------- 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]