Hi all,
I am trying to do the form field A and B.
Here is the example:
Field A will be required and should contain a non-whitespace string if B is true.
Here is the rule segement I defined in the validation.xml. I can't get it work correctly. Can someone tell me what I am doing it wrong. Thanks.
-Betty
<constant>
<constant-name>non_whitespace</constant-name>
<constant-value>^\S+$</constant-value>
</constant> <field
property="a"
depends="validwhen,mask">
<arg0 key="a.error_label"/>
<var>
<var-name>test</var-name>
<var-value>((b == 'false') or (*this* != null))</var-value>
</var>
<var>
<var-name>mask</var-name>
<var-value>${non_whitespace}</var-value>
</var>
</field>
Betty -
The validwhen test you have setup looks correct assuming the rule you want is:
if B = 'false' then A not required
if B = 'true' then A required (non-whitespace)
I don't think you can use that mask in conjunction with a validwhen - the mask will always be checked, meaning that A must always be non-whitespace - this is probably why it seems to not work.
Taking out the mask will probably fix your problem, but I'm not sure if validwhen's != null test will account for whitespaces, it is probably easiest to just take out the mask and see what happens.
Matt
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]