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

frontend validation fails if user removes all async uploaded files #22

Closed
SimJoSt opened this issue Feb 22, 2018 · 2 comments
Closed

frontend validation fails if user removes all async uploaded files #22

SimJoSt opened this issue Feb 22, 2018 · 2 comments

Comments

@SimJoSt
Copy link

SimJoSt commented Feb 22, 2018

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 the async option and enabling start, the required 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');

@innostudio
Copy link
Owner

@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.

@SimJoSt
Copy link
Author

SimJoSt commented Feb 26, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants