-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server validation error with related fields #6104
Comments
Thanks for reporting this. Please provide a sample application showing the issue by forking the following CodeSandbox (https://codesandbox.io/s/github/marmelab/react-admin/tree/master/examples/simple). |
Hello @djhi , Here: You must follow this steps:
This will trigger the "server side validation" error: bad title (i used my actual wrapper for create and edit)
this will trigger the save, but this time the form is valid and is submitted. |
Reproduced, thanks! |
you welcome :) |
any update on this? |
Nope, any help on this would be greatly appreciated |
With the release of react-admin v5, react-admin v3 has reached its end of life. We won't fix bugs or make any new release on the 3.x branch. We recommend that you switch to a more recent version of react-admin. So I'm closing this issue as we won't fix it. |
What you were expecting:
after the application of this:
#5938
in 3.13.2, React-admin handle the server side validation errors.
When a field is reported by the server with a validation error, it correctly show the error.
What happened instead:
The behaviour is correct:
but, when the fields are dependants, the form handling logic fails.
To better explain what i mean, please follow the example below
Steps to reproduce:
Let's try a form with:
SelectInput A: select the type of next item ( int, string)
TextInput B: the value regarding the type choosed on input A
now try to imagine that i submit:
A: Type Int
B: value "hello"
and submit.
The server reply with an error on the TextInput B "value not valid", because the type and the value doesn't match.
The first field is correct because it can only choose from a static list of values.
Now, instead of changing the TextInputB, i change the SelectInput A, to "string"
The error shown on TextInput B is still there, so when i submit i will get a correct save, because the form have logically valid values, but because the field B is still in error state, i will also get an error in the snackbar, that is wrong.
Other information:
imho the issue could be handled in this way:
Every change to the form will reset the server errors form-wide.
That's because the logic, in this scenario, is handled by the server and any modification can change the form validity, disregarding the 1-1 server-form field error type
The other way is, sadly, to disable the server side validation and handle the validation logic via frontend.
Environment
The text was updated successfully, but these errors were encountered: