Skip to main content

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​

Screen editor · DialogTab: DetailsSTATUSlistCANCELLATION_REASONconditional · requiredPAYMENT_METHODlistIBANconditional · visibleCANCELLATION_REASONColumn configurationDisplayFilterRulesEditDefaultsrequiredrequired_whenSTATUS=CANCELLED+ Adddisabled_when · disable_on_add · disable_on_editPick the fieldit is the screen columnEdit tabrequired / read-only rulesA conditionfield = value, ANDed

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 editor:

  1. Open the dialog in the Dialog builder and click the field — or select the column in the Columns tab.
  2. The inspector shows Column configuration, split into tabs: 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).
  3. Add one line per condition: the field (picked from the screen's columns) and the value, or several values.

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):

Columnvisible_when
IBANPAYMENT_METHOD = TRANSFER, DIRECT_DEBIT
BICPAYMENT_METHOD = TRANSFER, DIRECT_DEBIT
CARD_LAST4PAYMENT_METHOD = CARD

With CASH, none of the three fields shows. With TRANSFER, IBAN and BIC appear.

Mark a reason as required on cancellation​

Columnrequired_when
CANCELLATION_REASONSTATUS = CANCELLED

The field always shows; it gets the required asterisk as soon as the status is CANCELLED.

Lock a key once the row exists​

ColumnSetting
INVOICE_NUMBERdisable_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​

Columndefault_when
CREDIT_LIMITSTATUS = 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 General tab:

SettingValue
editable_whenPERIOD_STATUS = OPEN, VALIDATED

A row of a closed period opens in view-only mode, and the server refuses changes to it.


Things to know​

SituationWhat happensWhat 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​