onSubmitEnd

Specification

Called immediately after the submit ended, regardless of the submit status (on both successful and unsuccessful submit). Useful for interface changes, such as hiding a loader, to acknowledge the user that the submit action has ended.

Definition

1
type OnSubmitEnd = ({
2
res: Response, // Accumulated response of the async submit action
3
serialized: Object, // Serialized fields
4
fields: Object, // The state of the fields
5
form: ReactComponent // Reference to the Form component
6
}) => void
Copied!

Example

1
import React from 'react'
2
import { Form } from 'react-advanced-form'
3
import { Input } from 'react-advanced-form-addons'
4
5
export default class Example extends React.Component {
6
handleSubmitEnd = ({ res, serialized, fields, form }) => {
7
// ...
8
}
9
10
render() {
11
return (
12
<Form onSubmitEnd={this.handleSubmitEnd}>
13
<Input name="username" required />
14
<button type="submit">Submit</button>
15
</Form>
16
)
17
}
18
}
Copied!
Last modified 3yr ago