redux-form: Q: How to access errors on submit from outside of component when using synchronous validation
Hi, thanks for awesome work!
I’m using synchronous validation, which is blocking call to handleSubmit until all validations will pass… is there a place where I can get all errors on user’s attempt to submit a form (but not on every form state change)?
Pseudocode
handleSubmit(errors, values) {
if (errors) {
// --> here I would like to log all validation errors
} else {
dispatch(fooActions.save())
}
}
render() {
...
<FooForm
initialValues={...}
onSubmit={this.handleSubmit}
/>
...
}
or maybe better API
handleErrorSubmit(errors) {
// log errors
}
handleSubmit(values) {
dispatch(fooActions.save())
}
render() {
...
<FooForm
initialValues={...}
onSubmit={this.handleSubmit}
onErrorSubmit={this.handleErrorSubmit}
/>
...
}
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 18 (7 by maintainers)
Wow, are you in some competition for best support for open source project or what? 😃)
would you mind making a new release to npm? thx so much!