-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Feature request: Async validation #97
Comments
Admin-on-rest relies on redux-form for form validation, and redux-for supports asynchronous validation. So in theory it's not hard to do. Until we implement it, feel free to use your own |
+1 for async validation support. If the validation functions could return Promises to indicate async validation, that would be a simple and effective enough API. |
Fixed by #420 |
I could be mistaken, but as far as I can see, field level validation does not handle asynchronous validation. Is that correct? When I pass an async function (or a function which returns a Promise), AOR complains about the validation error not being a React node:
Redux form supports an |
Also experiencing the same issue as @edorivai |
As for as I know, async validation does not work at the field level, but there is a way to hook into the global async validation. See the tip at: https://marmelab.com/admin-on-rest/CreateEdit.html#global-validation The gist is: <TabbedForm asyncValidate={yourCustomAsyncValidationFunction}>
...
</TabbedForm> |
having the same issue as @edorivai and @sampeka. |
@edorivai well I got it working... on field level... You pass in the asyncValidate to the Form component, and the asyncBlurFields you pass in the fields that will trigger the asyncValidation. |
@fzaninotto now In the react 3.0 whether to support async validation?now did not use redux-form.so ,can async validation of server be realized? |
I suppose, since you can pass whatever props you want to the |
@fzaninotto you mean can use props 'asyncValidate' in SimpleForm of 3.0? |
I mean you have to look at how react-final-form handles it. I have no idea how it works, we don't need it for now, so you'll have to do the digging. |
@fzaninotto ok i have try ,thanks a lot |
It would be cool if validation errors when doing a POST/PUT of a resource could be displayed next to the appropriate fields in the edit view.
Eg. a post/put might return a 400 response with JSON data that contains a list of invalid fields along with error messages. The API client could then be configured to map the error response to a list of invalid resources with error message, and then the edit component could display these next to the inputs. The material-ui text field already supports showing errors using the
errorText
property.The text was updated successfully, but these errors were encountered: