Errors not passed into onSubmitFail
See original GitHub issueerrors
in the onSubmitFail is not being populated for me. Am I doing something wrong or is this a bug??
import React from 'react';
import { Field, reduxForm, SubmissionError } from 'redux-form';
const Password = (props) => {
const { handleSubmit, submitting, error } = props;
const submit = () => Promise.reject(new Error('test'));
return (
<form onSubmit={handleSubmit(submit)}>
<div>
<label htmlFor="password">Password</label>
<Field name="password" component="input" type="password" placeholder="Password" />
</div>
<h1>{error}</h1>
<div>
<button type="submit" disabled={submitting}>Next</button>
</div>
</form>
);
};
export default reduxForm({
form: 'password',
onSubmitFail: (e) => {
console.log(e); // shows undefined
throw new SubmissionError({ _error: e.message });
},
})(Password);
Issue Analytics
- State:
- Created 7 years ago
- Comments:15 (1 by maintainers)
Top Results From Across the Web
Developers - Errors not passed into onSubmitFail - - Bountysource
errors in the onSubmitFail is not being populated for me. Am I doing something wrong or is this a bug?? import React from...
Read more >What is the equivalent of the onSubmitFail from 'redux-form'
onSubmitFail does not seem to exist in react-final-form, is there an equivalent or a work around? In redux-form you could pass an onSubmitFail...
Read more >reduxForm(config:Object)
The function to call with the form data when the handleSubmit() is fired from within the form component. If you do not specify...
Read more >Form component · React Redux Form
Validation is specified by the validators and/or errors prop. ... The function passed into onSubmit={. ... In HTML, you are not allowed to...
Read more >Does MktoForms2 have an onFailure? Is there a way
onFailure(callback) I've read through the api many times, I can't see. ... onSubmitError is for network and server errors, like a TCP/IP ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Because this issue saw almost no activity for a few months, I’m closing it.
I had the same issue, error in props always give out undefined