Link Search Menu Expand Document

Validation handling

By default Liform React Final validates the values against schema per Ajv.

It reports validation errors as flat error object under liform.validationErrors and unpacks per Field validate and renderFinalForm.

You can provide your own Ajv instance per ajv prop.

import Ajv from 'ajv'

<Liform {...liformProps} ajv={new Ajv({
    // my config...
})}/>

You can provide a translation function to change representation of errors per ajvTranslator prop.

<Liform {...liformProps} ajvTranslator={
    (ajvErrorObject) => {
        //...
        return {
            fieldName: flattenedFieldName,
            message: myErrorMessage,
        }
    }
}/>