Set required

See also: Unset required, Form elements

Actions – Abstract

The action Set required sets the option 'required' at runtime for the linked Target element.

The action Set required sets the option 'required' at runtime for the linked Target element.

images/download/attachments/189433121/image-2024-10-8_11-4-6-version-1-modificationdate-1728378246834-api-v2.png

  • Without a link to a Target element, the action cannot be selected under Action type.

  • The effect of setting the required property for a particular element depends on its properties and the surrounding hierarchy in the form (see below).

  • The action is also available for Form elements for which the interactive setting of the required property via the properties window in the Form designer is not supported.

Consequences of the required property:

  • If the Target element is visible at runtime and the option 'Show label' is set, a red asterisk (*) is displayed to the right of the defined label of the element.

  • If the Target element is a direct parent of an Element containers for which the property 'Inherit required' is set, the required status is passed on to this element.

  • If the Target element can have a value by type, it is only considered 'valid' at runtime if a value (except $null) is assigned or the element is effectively inactive.

  • If the Target element can have a value according to its type and (like a Text field) allows the display of information texts, it appears with a red frame and the text 'This field is required'.

Since these criteria are evaluated independently of each other and also distributed along a cascade of nested elements with the option 'Inherit required', the action Set required can have many different effects depending on the hierarchy in the form design and the circumstances at runtime.

Example

Master data for customer payment transactions are entered in a form. Depending on the selection for the 'Direct debiting' Check box, the specification of an 'IBAN' (account number) in the Row layout 'Bank account details' should be required or not.

Runtime example:

Variant

Appearance in the form

'Direct debiting' unselected

images/download/attachments/189433121/image2020-6-22_16-20-4-version-1-modificationdate-1728376324646-api-v2.png

  • All elements can be filled optionally.

'Direct debiting' selected

images/download/attachments/189433121/image2020-6-22_16-20-29-version-1-modificationdate-1728376324648-api-v2.png

  • The 'IBAN' is now a required field. The label is passed on to the parent containers 'Bank account details' and 'Billing/Payment' via the option 'Inherit required', as the attached asterisk in the label indicates.

Configuration:

images/download/attachments/189433121/image-2024-10-8_11-5-45-version-1-modificationdate-1728378344917-api-v2.png

For the 'Direct debit' Check box, the behaviour displayed on the left is configured:

  • The Triggering event Changed with all Change types ensures that the required status for the Text field 'IBAN' is always set accordingly.


  • The Behaviour type Filled identifies for a Check box exactly the case that the check mark was set.


  • Under the Actions on 'true', the action Set required is executed with the Target element 'IBAN', so that this becomes a required field if the check mark for 'Direct debiting' is set.


  • Under the Actions on 'false', the action Unset required cancels the required field for the Target element 'IBAN', as long as the check mark for 'Direct debiting' is not set.

►NOTE◄ With this configuration, the default setting of the 'required' option in the form design for the 'IBAN' Text field at runtime is irrelevant, since the effective status is always determined by the action at runtime. However, this logic could be overridden by disabling the 'IBAN' element or one of the parent containers, since an effectively inactive element is always considered 'valid' and can then remain empty despite the required field state.