Visibleif (attribute of property)

From JRapid

Jump to: navigation, search

visibleif is an attribute of property.

Contents

Description

The visibleif condition specifies whether or not an element is visible.


Even invisible elements take up space on the form. Use the displayif attribute to create invisible elements that do not take up space.


The visibleif attribute value is an FPath expression that must return a boolean result. This expression enables the developer to query the current value of the form properties in order to check a condition.

Usage

<property
   ...
   visibleif="FPATH_CONDITION"
   ...
/>

Examples

A common condition for not showing a property is depending on a boolean property. This example shows the form for a Person entity and how a "spouse" property of type text is visible only when the boolean property "isMarried" is marked as true.

Note that the condition checks for the empty value first, as the "isMarried" boolean property has a null value when the form is opened for a new Person.

Even when invisible, the "spouse" property takes space on the form. Use displayif to hide elements without taking up space.

 <entity label="Person" name="Person">
        <property display="primary" label="Name" name="name"/>
        <property label="Is married" name="isMarried" type="boolean"/>
        <property label="Spouse" name="spouseName" visibleif="isMarried != '' and isMarried = 'true'" />
 </entity>


Visibleif condition with boolean example

See also

Personal tools