Rules
Rules allow for dynamic aspects for a form, e.g. by hiding or disabling UI schema elements.
A rule may be attached to any UI schema element and can be defined with the rule
property.
We'll first look at an example definition of a rule and then explain it in detail.
A rule basically works by first evaluating the condition
property and in case it evaluates to true, executing the associated effect
.
#
RuleEffectThe effect
property determines what should happen to the attached UI schema element once the condition
is met. In the example above, if the name
property has the value of foo
, we'll hide the UI schema element the rule is attached to. Current effects include:
HIDE
: hide the UI schema elementSHOW
: show the UI schema elementDISABLE
: disable the UI schema elementENABLE
: enable the UI schema element
The condition
property describes what value should be observed and validates that value with against the JSON schema that is specified with schema
. If validation succeeds the condition is fulfilled and the associated effect
will be triggered.
SchemaBasedCondition
s have been introduced with version 2.0.6 and have become the new default. The previous format via type
and expectedValue
properties is still supported for the time being.