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

ImageInput and FileInput required() is not working #8126

Closed
carlos-duran opened this issue Aug 31, 2022 · 4 comments · Fixed by #8150
Closed

ImageInput and FileInput required() is not working #8126

carlos-duran opened this issue Aug 31, 2022 · 4 comments · Fixed by #8150
Labels

Comments

@carlos-duran
Copy link
Contributor

What you were expecting:

When ImageInput has validate={[required()]} it should show the message in red
When FileInput has validate={[required()]} it should show the message

What happened instead:

ImageInput shows the message in gray (similar as helperText)
FileInput doesn't show the message

Steps to reproduce:

Related code:

Add validate={[required()]} to the FileInput tag
Add

        <ImageInput
          source="imagefile"
          label="Image"
          validate={[required()]}
          accept="image/*"
        >
          <ImageField source="src" />
        </ImageInput>

Other information:
image

Environment

  • React-admin version: 4.3.0
  • React version: 17.0.0
  • Browser: Chrome 100+
@fzaninotto fzaninotto added the bug label Sep 1, 2022
@fzaninotto
Copy link
Member

Thanks for the report! Marking this as a bug.

@carlos-duran carlos-duran changed the title ImageInput and FileInput validation issues ImageInput and FileInput required() is not working Sep 5, 2022
@nosequeldeebee
Copy link

Duplicate of #6441

@carlos-duran
Copy link
Contributor Author

Duplicate of #6441

I'm not sure if it's a duplicate because I didn't use the maxSize property and this issue is related to React Admin 4.

@nosequeldeebee
Copy link

nosequeldeebee commented Sep 6, 2022

I understand but the proposed outcome is the same as that issue and several other related ones. Fixing one will also address the others. We are asking the maintainers to validate the various properties available to FileInput and ImageInput which, as you note, they only partially did in #2660. I'd be happy to change this to "related to" if preferred.

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

Successfully merging a pull request may close this issue.

3 participants