Pārlūkot izejas kodu

Fix #1540: Better validation of `required` property

Kartik Visweswaran 5 gadi atpakaļ
vecāks
revīzija
8530f7f2e9
3 mainītis faili ar 5 papildinājumiem un 1 dzēšanām
  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;

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
js/fileinput.min.js


Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels