display validation errors for <ImageInput>
What you were expecting: ImageInput to display validation errors eg. "Required" as per the other input fields.
What happened instead: No validation error messages displayed.
Steps to reproduce:
Use the ImageInput component in a create or edit form, either with a validation function or maxSize property. Submit the form. The form is not submitted but not validation errors are displayed.
Related code:
<ImageInput
source="image"
label="Image"
accept="image/*"
maxSize={1}
validate={[required]}
>
<ImageField source="src" />
</ImageInput>
Environment
- Admin-on-rest version: 1.3.4
- React version: 15.6.2
- Browser: Chrome 64
Fixed by #2660
What about the maxSize property?
I see required() is displayed, but it would be nice to tell a user something when a file is rejected for whatever reason (e.g. File is too large).
Is there anyway to get this behavior?
For File and ImageInput, there is already a minSize and a maxSize property, see https://marmelab.com/react-admin/Inputs.html#imageinput
I’m aware of those two properties. But it does not display any error or messages after the file was rejected, at least not by default.
Can you please open a new issue then? don't forget to include a link to a CodeSandbox reproducing the problem (the simple CodeSandbox already has a FileInput in the CreatePost page).
Duplicate of #6441