Open artemportnoy opened 5 years ago
Check out our Upload component and how we wrote it. https://github.com/Availity/availity-react/tree/master/packages/upload
Essentially we create the CustomInput
tag and hide it from the DOM. Then we create our own button that we can customize to look like a button for uploading we want.
https://github.com/Availity/availity-react/blob/master/packages/upload/FilePickerBtn.js#L29-L39
Thank you, I think I'm on the right path but still facing some issues. Trouble is the error message passed to the callback in the custom validate function is not showing up. Also, validation method gets called as soon as the form renders so the field is in error state even before the user had a chance to enter something.
I've created a sandbox to demo the problem https://codesandbox.io/s/availity-custominput-file-rp4v2
Thanks!
Maybe this will help you out a little bit: https://codesandbox.io/s/availity-custominput-file-qxjix
You can't control the state of the file input so you can fake it like we do.
Hi,
I've scoured the web trying to find an example of making validation work for reactstrap's CustomInput of type "file" in AvForm and came back empty handed. My guess is I'm supposed to make use of AvField for this, but how? Is this at all supported?
Thanks, Artem