Unset required

See also: Set required, Form elements

Actions – Abstract

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

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

images/download/attachments/189433095/image-2024-10-8_10-15-26-version-1-modificationdate-1728375326726-api-v2.png

  • Without a link to a Target element, the action is not selectable under Action type.

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

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

Example

Master data for customer payment transactions are entered in a form. Depending on the country code (leading two characters) in the specified 'IBAN' (account number), the specification of a 'BIC' (SWIFT code of the bank) should be required or not. The starting point for the distinction is a positive list of SEPA country codes for which an IBAN without BIC is sufficient.

Runtime example:

Example

Appearance in the form

A bank transfer to Switzerland (CH) is possible via IBAN without BIC.

images/download/attachments/189433095/image2020-6-22_18-19-14-version-1-modificationdate-1728374298765-api-v2.png

For a bank transfer to the Seychelles (SC) the 'BIC' is a required field.

images/download/attachments/189433095/image2020-6-22_18-19-46-version-1-modificationdate-1728374298768-api-v2.png

Configuration:

images/download/attachments/189433095/image-2024-10-8_10-29-36-version-1-modificationdate-1728376176438-api-v2.png

For the Text field 'IBAN' the behaviour displayed on the left is configured:

  • The behaviour reacts to the Triggering event Changed with all Change types, so that the required field state for the 'BIC' always matches the entered 'IBAN'.


  • The Behaviour type Regular expression is used here because only the first two characters of the 'IBAN' have to be checked, which the simpler check with Filled with cannot do. The check should be considered 'passed' if the 'IBAN' is empty (^$) or (|)the first two characters in the given positive list of country codes ( BE|BG|DK|... ). Further rules (for the following paragraphs) will not be discussed here.


  • Under the Actions on 'true', the action Unset required ensures that the required field state for the Target element 'BIC' is removed if the check is passed.


  • Under the Actions on 'false', the action Set required ensures that the Target element 'BIC' becomes a required field if the IBAN identifies a country outside the SEPA list.

NOTE◄ With this configuration, the default setting of the option 'required' in the form design for the Text field 'BIC' 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 'BIC' 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.