Handling server errors with SimpleForm
nicolaskern opened this issue · 2 comments
Hi,
I'm trying to handle server validation errors once submission of a SimpleForm has been done.
My form is quite easily created:
<SimpleForm onSubmit={submitResults}>
<UserForm />
</SimpleForm>
And I have a simple way to throw a submission error, not calling the server for the moment:
const submitResults = (values) => {
throw new SubmissionError({firstname: "Firstname is wrong", lastname: "Lastname is not good", _error: "Submit Failed"});
};
According to https://marmelab.com/admin-on-rest/CreateEdit.html#validation and Redux Form, this should be fine: https://redux-form.com/6.5.0/examples/submitvalidation/.
However, I don't enter submitResults function, and the submission is made to the server which returns a 401 status which never gets understood.
What am I doing wrong?
Thanks,
Nicolas
Hi, and thanks for your question. As explained in the react-admin contributing guide, the right place to ask a "How To" question, get usage advice, or troubleshoot your own code, is StackOverFlow.
This makes your question easy to find by the core team, and the developer community. Unlike Github, StackOverFlow has great SEO, gamification, voting, and reputation. That's why we chose it, and decided to keep GitHub issues only for bugs and feature requests.
So I'm closing this issue, and inviting you to ask your question at:
http://stackoverflow.com/questions/tagged/react-admin
And once you get a response, please continue to hang out on the react-admin channel in StackOverflow. That way, you can help newcomers and share your expertise!
Thanks, here is the question on StackOverFlow : https://stackoverflow.com/questions/50928557/handling-server-errors-with-simpleform