Skip to content

renderFirstError() function

Creates a renderer function that renders the first validation error message of a validation result.

Syntax

renderFirstError()
renderFirstError(errorPropName)
renderFirstError(errorPropName, toString)

Parameters

  • errorPropName optional
    A property name of an error message supplied with a predicate function as anyData when adding as a constraint.
    Default: 'msg'.

  • toString optional
    A function that accepts a validation result entry with the property name in it, index, and an Array of the entries and returns a string.
    Default: implementation: render-entry.js.

Return value

A function that accepts a ValidationResult object and returns a string.

Description

Creates a function that is intended to be used as the value property in the stateValues object which is passed as a parameter into the applyBox() function.


Implementation: render-first-error.js.

Examples