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

Validation isn't triggered when file is selected #302

Open
fc opened this issue Nov 17, 2021 · 1 comment
Open

Validation isn't triggered when file is selected #302

fc opened this issue Nov 17, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@fc
Copy link

fc commented Nov 17, 2021

Current Behavior 😯

Select a file to upload using the SimpleFileUpload component that fails validation and see that it does not display an error message

Expected Behavior 🤔

Shows error immediately if selected file does not pass validation.

Steps to Reproduce 🕹

  1. Go here https://codesandbox.io/s/great-pare-3fk5z?file=/src/index.tsx
  2. Select a file
  3. Click submit

A suggested fix

Call setFieldTouched(field.name, true) in the onChange callback.

@fc fc added the bug Something isn't working label Nov 17, 2021
@anasaijaz
Copy link

Why is the file key inside the value interface have only two allowed types i.e. a File and an empty string?
interface Values { file: '' | File; }
The problem is the errors also have the Partial Value type and I am not able to assign it a string
(If I am not wrong the values inside the error object are displayed as error)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants