Skip to content
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

display validation errors for <ImageInput> #1611

Closed
jamesjwarren opened this issue Mar 5, 2018 · 6 comments
Closed

display validation errors for <ImageInput> #1611

jamesjwarren opened this issue Mar 5, 2018 · 6 comments

Comments

@jamesjwarren
Copy link

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
@fzaninotto fzaninotto changed the title ImageInput doesn't display validation errors display validation errors for <ImageInput> Mar 14, 2018
@fzaninotto
Copy link
Member

Fixed by #2660

@jasonlimantoro
Copy link

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?

@fzaninotto
Copy link
Member

For File and ImageInput, there is already a minSize and a maxSize property, see https://marmelab.com/react-admin/Inputs.html#imageinput

@jasonlimantoro
Copy link

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.

@fzaninotto
Copy link
Member

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).

@nosequeldeebee
Copy link

Duplicate of #6441

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants