messages

Specification

Form-specific validation messages.
Providing form-specific validation messages is designed to extend/rewrite the messages applied application-wide. For general usage it is recommended to pass the validation messages to the FormProvider component to be applied application-wide.

Example

1
import React from 'react'
2
import { Form } from 'react-advanced-form'
3
4
const formMessages = {
5
extend: true, // merge the current messages with the FormProvider's ones
6
type: {
7
email: {
8
invalid: 'Custom message for invalid email fields of this very form',
9
},
10
},
11
}
12
13
export default class Example extends React.Component {
14
render() {
15
return (
16
<Form messages={formMessages}>
17
{/* Fields here */}
18
</Form>
19
)
20
}
21
}
Copied!

Materials

Last modified 3yr ago