VisibleIf

XML Forms Guide

Version
R2024.1.1
VisibleIf

The <VisibleIf> tag controls the visibility of a control in a form based on the value selected in another control. The <VisibleIf> tag can be used with the following tags:

  • CascadingCountryStateSelector
  • EmployeePicker
  • EmployeeProperty
  • Field
  • Label
  • OptionSelector
  • Panel
  • RecruiterPicker

The following example demonstrates how to use the tag to display a control if a particular value is selected in another field:

Copy
<VisibleIf>FieldId:Value</VisibleIf>

In the next example, the control will be displayed if the three specified values are not selected for the other field:

Copy
<VisibleIf>FieldId:NOT(Value1,Value2,Value3)</VisibleIf>

The source field can be a ComboBox or a CheckBox with a <FieldId> configured and the <SelectionChangedEventProcess> tag configured to 'True'. The data provider underlying the structure must have an 'XRefCode' value defined; the cross-reference code value is used to control if the field is visible.

You can configure multiple dependencies by adding a "type" extension to the <VisibleIf> tag. The type attribute must be in lowercase. Accepted values are "and" and "or" inside single or double quotation marks. The following example demonstrates a complex use case where visibility of the element is conditional on AUS or ClassA or (Not CAN and ClassB):

Copy
<VisibleIf type="Or">
   <VisibleIf>ComboPayGroup:AUS</VisibleIf>
   <VisibleIf>ComboPayClass:ClassA</VisibleIf>
   <VisibleIf type="And">
      <VisibleIf>ComboPayGroup:NOT(CAN)</VisibleIf>
      <VisibleIf>ComboPayClass:ClassB</VisibleIf>
   </VisibleIf>
</VisibleIf>