Browse Source

Fix #1540: Better validation of `required` property

Kartik Visweswaran 5 years ago
parent
commit
8530f7f2e9
3 changed files with 5 additions and 1 deletions
  1. 1 0
      CHANGE.md
  2. 4 1
      js/fileinput.js
  3. 0 0
      js/fileinput.min.js

+ 1 - 0
CHANGE.md

@@ -9,6 +9,7 @@ Change Log: `bootstrap-fileinput`
 - (bug #1551): Correct MIME Type detection for PNG.
 - (enh #1548): Correct `filebatchselected` trigger for single file uploads.
 - (enh #1545, #1546): Enhance file path for folder drag.
+- (enh #1540): Better validation of `required` property.
 - (bug #1518, #1522): Initial preview rendering correction when preview returned by server immediately after upload.
 
 ## version 5.0.8

+ 4 - 1
js/fileinput.js

@@ -4740,6 +4740,9 @@
         },
         _isFileSelectionValid: function (cnt) {
             var self = this;
+            if (self.isDisabled) {
+                return true;
+            }
             cnt = cnt || 0;
             if (self.required && !self.getFilesCount()) {
                 self.$errorContainer.html('');
@@ -5305,7 +5308,7 @@
         upload: function () {
             var self = this, fm = self.fileManager, totLen = fm.count(), i, outData,
                 hasExtraData = !$.isEmptyObject(self._getExtraData());
-            if (!self.isAjaxUpload || self.isDisabled || !self._isFileSelectionValid(totLen)) {
+            if (!self.isAjaxUpload || !self._isFileSelectionValid(totLen)) {
                 return;
             }
             self.lastProgress = 0;

File diff suppressed because it is too large
+ 0 - 0
js/fileinput.min.js


Some files were not shown because too many files changed in this diff