HomePage | RecentChanges | Preferences

Notes on validwhen

Some working examples...

<!-- Either a residence or a business address is required -->
<field property="addressLines" depends="validwhen">
   <arg key="label.either.address"/>
            ( ( ( (*this* != null) and (city != null) ) and (state != null) ) and (zip != null) )
            ( ( ( (businessAddressLines != null) and (businessCity != null) ) and (businessState  != null) ) and (businessZip != null) )

Assertion: There is no client-side validation available for validwhen

True. The bundled validator-rules.xml file has no 'jsFunction' attribute for validwhen.

Assertion: validwhen only works with String and Integer fields

Problem: Trying to validate that a checkbox associated with a java.lang.Boolean type field in a dynamic form is checked.

A simple 'required' check always passes-- the field is always either true or false, so it has a value.

The request contains contactReportFlag? = on

The populated form bean is: DynaActionForm?[dynaClass=assignmentRequestForm?,contactReportFlag?=true {...} ]


No 'isInstance' checks for Boolean in [ValidWhenParser.g]

And nothing works:


      <form-bean name="assignmentRequestForm"
          <form-property name="contactReportFlag" type="java.lang.Boolean" initial="false"/>


            <!-- The Contact Report checkbox must be checked -->
            <field property="contactReportFlag" depends="validwhen">
                <arg key=""/>
                    <var-value>(*this* == 'true')</var-value>
Other tries
                     <var-value>(*this* == 'on')</var-value>

HomePage | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited August 31, 2006 8:49 am by WendySmoak (diff)