Conditional fields
A static dialog asks the same questions every time. A conditional dialog adapts to what the user has already chosen: show IBAN only for a bank transfer, mark Cancellation reason as required only for a cancelled order, lock the Invoice number once the invoice exists.
The settings and their exact behaviour are listed on Form conditions. This page shows how to set them up.
At a glance
Where to set them
A dialog field displays a screen column, and the column carries every behaviour — the same settings drive the dialog and the grid. In the Screen Designer:
- On the Record form stage, click the field in the Dialog builder — or, on the Grid stage, pick the column in Columns.
- The column's settings show, split into tabs (Column configuration in the Inspector): the conditions sit in Filter (
visible_when), Edit (required_when,disabled_when,disable_on_add,disable_on_edit), Defaults (default_when,write_when) and Rules (rules_when). - Under the setting, + add opens a new condition in the same panel — its breadcrumb reads Required When: (new), for example: pick the Field among the screen's columns and give the Value, or several values (+ add under Value). The breadcrumb leads back to the column.
All the lines of one setting must match together (AND). For an OR on the same field, list the values in one condition.
Worked examples
Show fields for one choice
A Payment dialog where PAYMENT_METHOD is a list (CASH, TRANSFER, DIRECT_DEBIT, CARD):
| Column | visible_when |
|---|---|
IBAN | PAYMENT_METHOD = TRANSFER, DIRECT_DEBIT |
BIC | PAYMENT_METHOD = TRANSFER, DIRECT_DEBIT |
CARD_LAST4 | PAYMENT_METHOD = CARD |
With CASH, none of the three fields shows. With TRANSFER, IBAN and BIC appear.
Mark a reason as required on cancellation
| Column | required_when |
|---|---|
CANCELLATION_REASON | STATUS = CANCELLED |
The field always shows; it gets the required asterisk as soon as the status is CANCELLED.
Lock a key once the row exists
| Column | Setting |
|---|---|
INVOICE_NUMBER | disable_on_edit ticked |
The number is typed when the invoice is added, then read-only — in the dialog and in grid editing. disable_on_add does the reverse, for a value assigned on creation.
Force a value for one kind of row
| Column | default_when |
|---|---|
CREDIT_LIMIT | STATUS = CANCELLED → default 0, lock on |
As soon as the status becomes CANCELLED, the limit switches to 0 and locks. With lock off, 0 is only proposed and the user can change it.
Make closed periods read-only
On the screen's What it is stage:
| Setting | Value |
|---|---|
editable_when | PERIOD_STATUS = OPEN, VALIDATED |
A row of a closed period opens in view-only mode, and the server refuses changes to it.
Things to know
| Situation | What happens | What to do |
|---|---|---|
| The deciding field is not on the dialog. | Its value is unknown to the form: the condition never matches, and the dependent field stays hidden. | Add the deciding field to the dialog, hidden or not. |
visible_when on a key column. | A user adding a row may not see the key. | Lock a key (disable_on_edit); do not hide it. |
required_when matches while visible_when does not. | A hidden field is never demanded: Save goes through with it empty. | Keep the two conditions in line. |
| A value with different spelling. | The condition never matches: values are compared exactly (only the surrounding spaces are ignored). | Copy the stored codes, not their labels. |
A threshold (AMOUNT > 1000). | Conditions only test equality. | Return a flag from the read query (HIGH_VALUE = 'Y') and test that flag. |
What's next
- Form conditions — the full list of settings and where each one is checked.
- Columns — the other column settings.
- Actions and lifecycle — run actions when the form loads, saves or is cancelled.