Closed SimJoSt closed 6 years ago
@SimJoSt required attribute is not recommended to be used with the Fileuploader. The Plugin is cloning sometimes the input without required attribute to prevent other issues.
The best practice is to use API methods to get the number of files or to read the hidden Fileuploader's input.
We currently have a quite simple validation in use and hoped for it to just work, by checking if the hidden Fileuploader's filled. That is most easily done, by setting the required attribute on the input. But we can make do without.
Our input tag includes a
required
attribute. This makes it possible for frontend validation to fail, if no files have been added/uploaded. When using theasync
option and enablingstart
, therequired
attribute gets removed by the plugin after the first added/uploaded file. If this file/all files is/are removed by the user, the attribute does not get readded to the input tag, breaking the frontend validation.Additionally, to make validators like https://github.com/1000hz/bootstrap-validator work reliably, the changed field (either setting the
required
attribute or changing the value) should be triggered with.trigger('change');