1

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's wrong with this approach?

Amit Verma
  • 8,660
  • 8
  • 35
  • 40
Nicolas Kern
  • 279
  • 2
  • 3
  • 11
  • Possible duplicate of [how can I show customized error messaged from server side validation in React Admin package?](https://stackoverflow.com/questions/50237163/how-can-i-show-customized-error-messaged-from-server-side-validation-in-react-ad) – Christiaan Westerbeek Jun 19 '18 at 13:43
  • 1
    Yes, it's quite the same, although I found a working solution there : https://github.com/marmelab/react-admin/pull/871 – Nicolas Kern Jun 21 '18 at 07:59

0 Answers0