el (Read element data)
The $el function is used to read data from a form element. The ID of the element is passed as a parameter. Als Parameter wird die ID des Elements übergeben.
Optionally, the data of all duplicates can also be requested as a list (see parameter description of duplicatesToo).
Tip: The $el function can be inserted automatically with the correct element ID by clicking on the link symbol below the expression input field. Any element can then simply be selected in the form by clicking on it.
Syntax
$el(elementId[,duplicatesToo])
Parameter
Name |
Description |
elementId |
The ID of the required form element. |
duplicatesToo |
An optional parameter that specifies whether the values of all duplicates of the specified element should be returned as a list. When $el is executed in a calculation that is inside a repeating element, this parameter can be omitted or set to false to read the value of an element in the same repeating hierarchy. |
Return value
Returns the value of the element with the transferred ID or null if the value of the element is empty or the element does not exist. The duplicatesToo=true paramenter returns a list of the values of all duplicates of the passed element.
Example
A short form with a Repeatable element container and two buttons demonstrates how the $el function can be used.
The Read all text fields button reads the values of all repeated text fields (element ID 5) and outputs them in an alert box separated by a line break. For this the help function $concatWS(separator, ... list) is used, which is described in a separate chapter of the manual. To read the values of all duplicated text field instances as a list, the duplicatesToo parameter was set to true.
The Read text field button, on the other hand, only reads the value of its 'own' text field, which is located in the same row. The duplicatesToo parameter was not transferred for this and is therefore false by default.
Result of the configuration
Launched form |
Click on 'Read all text fields' |
Click on 'Read text field' (second row) |
|
|
|