Writing XML to have Interdependent Require Fields
Writing Interdependent Required Fields[edit]
Where either one field or another (but only one field) must be filled in.
A condition for each of the fields to determine if it is empty:
<Condition no_cache="true"> <ZName>XXX_not_present_condition</ZName> <DisplayName>XXX should be entered</DisplayName> <Field> <ZName>XXXXX</ZName> </Field> <Test>Equals</Test> <DesiredValue> <StaticValue></StaticValue> </DesiredValue> </Condition>
Validation to ensure at least one of the fields is populated:
<Validation class="Value"> <ZName>XXX_validation</ZName> <DisplayName>XXX or YYY must be entered</DisplayName> <ClassOptions> <Required>true</Required> </ClassOptions> <PassOnConditionFail>true</PassOnConditionFail> <Condition> <ZName>XXX_not_present_condition</ZName> </Condition> </Validation>
Conditional Format to hide the 'opposite' field when one field is populated
<ConditionalFormat> <ZName>XXX_hide_cf</ZName> <classes>zz_disabled</classes> <DisableInputs>true</DisableInputs> <Condition> <ZName>XXX_present_condition</ZName> <Base>XXX_not_present_condition</Base> <Test>NotEqual</Test> </Condition> </ConditionalFormat>
Note that there is a generic class to hide things in the main CSS (hidden) - however, using it rather than just disabling the inputs causes the other fields to move around and is not ideal.
Add a ShortDescription to each field explaining that the other field can be shown by clearing 'this' one.