Skip to content

@serenity-is/corelib / checkValidationRules

Function: checkValidationRules()

checkValidationRules(validationRules, value, context?): string

Defined in: src/ui/helpers/validationrules.ts:151

Checks a value by validation rules, in their order, stopping at the first one it is not valid by. An empty value is valid. A rule that is neither registered by a function nor a loaded class is skipped, as the server still checks it, with a warning unless its class is still being loaded, see loadValidationRules.

Parameters

validationRules

ClientValidationRule[]

The rules, as the server sends them.

value

any

The value.

context?

ValidationRuleContext

The element and the other fields.

Returns

string

The message of the first rule the value is not valid by, or null.