Expression Formfield
A JavaScript expression field for dynamic values and calculations, supporting both local (browser) and remote (server) execution for advanced use cases.
Properties
| Attribute | Comments |
|---|---|
| basic | |
| name string / required / unique | Field name
This attribute represents the name of the form field. |
| type string / required | Field type
Other attributes might only be available for some field types. Choices:
|
| label string | Field label
A friendly name/label for the field. Note: if not set, the field name is used as label, but not when type is html. Since 6.0.3: Supports placeholders for dynamic labels (e.g., |
| placeholder string | In-field help value
Some form fields allow an in-field hint value. Since 6.0.3: Supports placeholders for dynamic hints (e.g., |
| help string | Field help message
Some fields require additional help information. This help message will be shown below the field. Since 6.0.3: Supports placeholders for dynamic help text (e.g., |
| data | |
| value any added in version 4.0.17 | A fixed value (any type) for the expression
To manually populate an expression field (dictionary, array, number, boolean, string). |
| default many | Default value
The type of the value depends on the field type.
|
| evalDefault boolean added in version 4.0.5 | Evaluates default value
A default can be treated as javascript and can thus hold expressions like Default: false |
| expression string | A javascript expression.
By default this javascript is evaluated on the server side and limited to predefined functions (for security). However in combination with tip : use the alias |
| runLocal boolean | Run an expression locally
When running expressions, by default they are run remotely on the server. Default: false |
| refresh boolean|string | Allow a manual or auto refresh
A query or expression is by default run once (if it doesn’t contain any dependencies). Default: false |
| editable boolean | Makes an expression editable
An expression is by default readonly. Default: false |
| dbConfig string, array or object | A database connection
When you want to query data from a database, you will need the proper connection information. |
| query string | The query to select data from a database
This is typically a classic SELECT statement. |
| jq string added in version 6.1.4 | Transform database query results with jq
Apply a jq expression to transform the returned database result. |
| interaction | |
| dependencyFn string added in version 4.0.0 | The dependency logical function
This attribute represents the logical function between multiple dependencies. Choices:
|
| dependencies list / elements=object | Show/hide this field based on the values or other fields
Each dependency element is either an object with the following 2 attributes:
Or with the following 2 attributes:
Use in combination with attribute |
| output | |
| noOutput boolean | Do not output as extravar
Form fields are by default send as extravars. Default: false |
| model string or array | Extravar modelling
By default, a field is sent as a root-extravar. |
| asCredential boolean | Send credential as extravar
Use the value of this field to search for a credential with the same name Since 4.0.16, you can use this in combination with the Default: false |
| security | |
| noLog boolean added in version 2.2.3 | Disable backend logging
Disables logging in the backend, to hide passwords for example. Default: false |
| validation | |
| required boolean | Required field
Makes the field required. Default: false |
| minLength number | Field minimum length
Forces a string-field to be at least x long. Since 6.0.3: Supports placeholders for dynamic validation (e.g., |
| maxLength number | Field maximum length
Forces a string-field to be maximum x long. Since 6.0.3: Supports placeholders for dynamic validation (e.g., |
| regex object | A regular expression validation
Enforces a validation where the current field must match a regular expression. This field requires an object with 2 attributes:
|
| notIn object added in version 2.2.4 | A list validation (can not be in list)
Enforces a validation where the current field can not be one of the values in a list (referencing another field). This field requires an object with 2 attributes:
|
| in object added in version 2.2.4 | A list validation (must be in list)
Enforces a validation where the current field must be one of the values in a list (referencing another field). This field requires an object with 2 attributes:
|
| validIf object added in version 2.2.4 | An field based validation (field must be true)
Enforces a validation where a referencing (expression) field must be true. This field requires an object with 2 attributes:
|
| validIfNot object added in version 2.2.4 | An field based validation (field must be false)
Enforces a validation where a referencing (expression) field must be false. This field requires an object with 2 attributes:
|
| sameAs string | An field based validation (field must be same as other field)
Enables a validation where the value of this field must match the value of another field. Perfect for password entry, for example. |
| ignoreIncomplete boolean | Allow form submit on non-evaluated placeholders
When an expression-based field has placeholders, Default: false |
| visualization | |
| icon string | Field icon
Some formfields can hold a nice looking icon. The icon name is a free fontawesome 6 icon. You can find more information at www.fontawesome.com |
| group string | The field group name
With this attribute you can group fields together. |
| line string added in version 4.0.3 | The field line name
With this attribute you can group fields in a single line together. |
| width string added in version 4.0.3 | The field width
With this attribute you can set the width of a field. Choices:
|
| isHtml boolean | Renders text as html
If an expression value has html tags (for example ), it will render the value as such. Default: false |
| hide boolean | Hides an expression field
Set to Default: false |
| name string / required / unique | Field name
This attribute represents the name of the form field. |
| type string / required | Field type
Other attributes might only be available for some field types. Choices:
|
| label string | Field label
A friendly name/label for the field. Note: if not set, the field name is used as label, but not when type is html. Since 6.0.3: Supports placeholders for dynamic labels (e.g., |
| placeholder string | In-field help value
Some form fields allow an in-field hint value. Since 6.0.3: Supports placeholders for dynamic hints (e.g., |
| help string | Field help message
Some fields require additional help information. This help message will be shown below the field. Since 6.0.3: Supports placeholders for dynamic help text (e.g., |
| icon string | Field icon
Some formfields can hold a nice looking icon. The icon name is a free fontawesome 6 icon. You can find more information at www.fontawesome.com |
| group string | The field group name
With this attribute you can group fields together. |
| line string added in version 4.0.3 | The field line name
With this attribute you can group fields in a single line together. |
| width string added in version 4.0.3 | The field width
With this attribute you can set the width of a field. Choices:
|
| dependencyFn string added in version 4.0.0 | The dependency logical function
This attribute represents the logical function between multiple dependencies. Choices:
|
| dependencies list / elements=object | Show/hide this field based on the values or other fields
Each dependency element is either an object with the following 2 attributes:
Or with the following 2 attributes:
Use in combination with attribute |
| noLog boolean added in version 2.2.3 | Disable backend logging
Disables logging in the backend, to hide passwords for example. Default: false |
| value any added in version 4.0.17 | A fixed value (any type) for the expression
To manually populate an expression field (dictionary, array, number, boolean, string). |
| default many | Default value
The type of the value depends on the field type.
|
| evalDefault boolean added in version 4.0.5 | Evaluates default value
A default can be treated as javascript and can thus hold expressions like Default: false |
| required boolean | Required field
Makes the field required. Default: false |
| minLength number | Field minimum length
Forces a string-field to be at least x long. Since 6.0.3: Supports placeholders for dynamic validation (e.g., |
| maxLength number | Field maximum length
Forces a string-field to be maximum x long. Since 6.0.3: Supports placeholders for dynamic validation (e.g., |
| regex object | A regular expression validation
Enforces a validation where the current field must match a regular expression. This field requires an object with 2 attributes:
|
| notIn object added in version 2.2.4 | A list validation (can not be in list)
Enforces a validation where the current field can not be one of the values in a list (referencing another field). This field requires an object with 2 attributes:
|
| in object added in version 2.2.4 | A list validation (must be in list)
Enforces a validation where the current field must be one of the values in a list (referencing another field). This field requires an object with 2 attributes:
|
| validIf object added in version 2.2.4 | An field based validation (field must be true)
Enforces a validation where a referencing (expression) field must be true. This field requires an object with 2 attributes:
|
| validIfNot object added in version 2.2.4 | An field based validation (field must be false)
Enforces a validation where a referencing (expression) field must be false. This field requires an object with 2 attributes:
|
| sameAs string | An field based validation (field must be same as other field)
Enables a validation where the value of this field must match the value of another field. Perfect for password entry, for example. |
| ignoreIncomplete boolean | Allow form submit on non-evaluated placeholders
When an expression-based field has placeholders, Default: false |
| noOutput boolean | Do not output as extravar
Form fields are by default send as extravars. Default: false |
| model string or array | Extravar modelling
By default, a field is sent as a root-extravar. |
| asCredential boolean | Send credential as extravar
Use the value of this field to search for a credential with the same name Since 4.0.16, you can use this in combination with the Default: false |
| expression string | A javascript expression.
By default this javascript is evaluated on the server side and limited to predefined functions (for security). However in combination with tip : use the alias |
| runLocal boolean | Run an expression locally
When running expressions, by default they are run remotely on the server. Default: false |
| refresh boolean|string | Allow a manual or auto refresh
A query or expression is by default run once (if it doesn’t contain any dependencies). Default: false |
| isHtml boolean | Renders text as html
If an expression value has html tags (for example ), it will render the value as such. Default: false |
| hide boolean | Hides an expression field
Set to Default: false |
| editable boolean | Makes an expression editable
An expression is by default readonly. Default: false |
| dbConfig string, array or object | A database connection
When you want to query data from a database, you will need the proper connection information. |
| query string | The query to select data from a database
This is typically a classic SELECT statement. |
| jq string added in version 6.1.4 | Transform database query results with jq
Apply a jq expression to transform the returned database result. |
Examples
Expressions
since expressions are so diverse, there is a separate section on expressions with examples.