isElValid (Validating element)

The $isElValid function is used to validate an element or its duplicates. If all elements are valid, true is returned, otherwise false. The ID of the element is passed as a parameter. Optionally, all duplicates can be validated (see parameter description of duplicatesToo).

The $isElValid function is used to validate an element or its duplicates. If all elements are valid, true is returned, otherwise false. The ID of the element is passed as a parameter.
Optionally, all duplicates can also be validated (see parameter description of duplicatesToo).

Syntax

$isElValid(elementId[,duplicatesToo[,validationResultVar]])

Parameter

Name

Description

elementId

The ID of the required form element.

duplicatesToo
(Standard: false)

An optional parameter that specifies whether all duplicates of the specified element should also be validated.
For example, duplicates of an element are instances in a Repeatable element container.

If $isElValid is executed in a calculation that is inside a repeatiable element, this parameter can be omitted or set to false to validate an element inside the same repeating hierarchy.

validationResultVar
(optional)

Can optionally define a form variable in which the validation results of invalid elements are written as a list of texts. See the example below.

Return value

Returns true if all queried elements are valid, otherwise false.

Example

A short form with a Repeatable element container and a validation button demonstrates how the $isElValid function can be used.

images/download/attachments/62863689/image2020-4-3_9-26-49-version-1-modificationdate-1610618072495-api-v2.png

The 'Repeatable element' container contains a text field with element ID 6, which is a required field (so it is invalid as long as it is empty).
The Check button executes a Calculate behaviour when clicked, which validates all duplicates of the text field (ID 6) in the check expression (1).

As an action, either an Alert title and the message 'Valid' or an Alert title 'Invalid' and the validation messages (1) (separated by line breaks (\n) via $concatWS function) is displayed as a message.

Explanation: The validation messages were written to the variable 'validationResult' in expression (1) and can therefore be read out again with the calculation function $var in (2).

Result of the configuration

Launched form

Click on 'Check'

images/download/attachments/62863689/image2020-4-3_9-20-23-version-1-modificationdate-1610618072536-api-v2.png

images/download/attachments/62863689/03-04-_2020_09-20-47-version-1-modificationdate-1610618072529-api-v2.png


images/download/attachments/62863689/image2020-4-3_9-23-42-version-1-modificationdate-1610618072511-api-v2.png

images/download/attachments/62863689/image2020-3-30_11-13-1-version-1-modificationdate-1610618072543-api-v2.png