This repository was archived by the owner on Aug 23, 2022. It is now read-only.
This repository was archived by the owner on Aug 23, 2022. It is now read-only.
<Control.file /> valid true if validation function returns false ( #784
Open
Description
The Problem
<Control.file /> valid true if validation function returns false (
First upload only. Other uploads show error message as excepted.
Steps to Reproduce
Load form, and upload .pdf file (no error). Then upload .png (no error), and again .pdf (error shown).
Expected Behavior
Error message on first upload.
Actual Behavior
No error message on first upload.
Reproducible Code Example
fv = (formats, file) => !file || !_.first(file) || _.indexOf(formats.split(',').map((i) => i.trim()), _.first(file).name.split('.').pop()) != -1;
<Control.file model=".file" validators={{ format: fv.bind(this, 'jpg,png') }} />
<Errors model=".file" messages={{ format: 'Wrong format' }}/>