When using forms in your processes it can be useful 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 i 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 viewmode 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.
Click on OK.
- Is equal to - Use for comparing exactly with the compare value
- Is not equal to - Use to make sure the value isn't 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 contains 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 starts 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.
- 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 klick 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 click on OK to save the new settings.
Click on Save.
TIP: You can also disable a rule if you 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:
- 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 3 field attributes always win over contradicting rules.