Validation isn't triggered when file is selected
fc opened this issue Β· comments
Clay commented
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 πΉ
- Go here https://codesandbox.io/s/great-pare-3fk5z?file=/src/index.tsx
- Select a file
- Click submit
A suggested fix
Call setFieldTouched(field.name, true)
in the onChange
callback.
anasaijaz commented
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)