When using forms in your processes, it can be helpful to change form field settings depending on previous selections or inputs in the form. The rules editor makes it easy to change if a field is optional or not, hidden or shown, or if it is enabled or disabled according to conditions depending on previous inputs in the form.
Add form rules
- Open your form and click on the Form rules icon in the upper menu
- Click on Add new rule
- Select a form field, a condition (see all conditions below) and, if requested, a compare value. You can also select [VIEWMODE] as a condition and configure a rule to trigger based on which view mode the form is in.
- State the action by selecting a second form field and choose an action for that field (see all available actions below).
If desired, add more conditions and actions.
Select OK.
Important: It is not possible to use OR Conditions with the rule editor.
Available conditions
- Is equal to - Use for matching exactly with the compare value
- Is not equal to - Use to make sure the value is not equal to the compare value
- Contains - Check if the selected field contains the compare value
- Does not contain - Check if the selected field does not contain the compare value
- Starts with - Check if the selected field starts with the compare value
- Doesn't start with - Check if the selected field does not start with the compare value
- Ends with - Check if the selected field ends with the compare value
- Doesn't end with - Check if the selected field does not end with the compare value
- Is empty - Check that the form field is empty
- Is filled - Check that the form field contains information
- Any of - Check that the selected field contains any of the compare values in the given comma separated list.
- Not any of - Check that the selected field does not contains any of the compare values in the given comma separated list.
Note: All available conditions do not apply to all kinds of field types. For example checkboxes can only be empty or filled. This also applies to usage of superboxtypefields with contains as condition for the rule, then the value has to be declared exactly for the rule to be valid. That is to say contains won't match the sub-string of a value it only matches the exact definition of the value.
Available actions
- Required - The form field will be mandatory to fill
- Optional - The form field will be optional to fill
- Hidden - The form field will be hidden
- Hidden and Cleared - The form field will be hidden and emptied
- Shown - The form field will be shown
- Enabled - The form field will be enabled and can be edited
- Disabled - The form field will be disabled and can't be edited
Note: A field configured with allowBlank = false will always be considered mandatory regardless of any rules. It is recommended that you configure a rule to set mandatory and optional settings if you want the field to change dynamically.
Edit or remove form rules
Open the Form rules editor
- a) If you want to remove an entire rule and all its actions click on the trash can to the right of the rule
b) If you want to edit a specific rule, click on the pen symbol to the right of the rule, settings for the condition and the actions are shown. Edit as desired and select OK to save the new settings.
Click on Save.
TIP: You can also disable a rule if you would like to pause its conditions and actions but not remove the setting totally. Click on the square symbol to the right of a rule to inactivate the rule.
Execution & Hierarchy of form rendering
Form rules are executed from top to bottom. You can drag and drop rules in order to change the order they execute in.
Hierarchy for form upon render:
- The form is rendered and field configuration settings are applied
- The viewMode and State attribute settings are applied as well, in the following order:
- hideInState
- hideInViewmode
- lockedInViewmode
- lockedInState
- allowBlankInViewmode
- Rules are applied in their configured order. If the form contains custom listeners, they will affect the form as well.
Note: Rules can never override the field attributes hideInViewmode, lockInViewmode and allowBlankInViewmode. E.g. You cannot create a form rule that shows a field if the field is hidden by the attribute hideInViewmode. These three field attributes always win over contradicting rules.