浏览代码

Merge branch 'master' of https://github.com/AlaskanShade/bootstrapvalidator into AlaskanShade-master

Conflicts:
	src/js/validator/different.js
phuoc 11 年之前
父节点
当前提交
8ffa949f40
共有 1 个文件被更改,包括 12 次插入5 次删除
  1. 12 5
      src/js/validator/different.js

+ 12 - 5
src/js/validator/different.js

@@ -29,13 +29,20 @@
             if (compareWith === null || compareWith.length === 0) {
                 return true;
             }
+            var spl = options.field.split(',');
+            var isValid = true;
+            for (i = 0; i < spl.length; i++) {
+                var compareWith = validator.getFieldElements(spl[i]);
+                if (compareWith == null) {
+                    continue;
+                }
 
-            if (value !== compareWith.val()) {
-                validator.updateStatus(options.field, validator.STATUS_VALID, 'different');
-                return true;
-            } else {
-                return false;
+                if (value == compareWith.val())
+                    isValid = false;
+                else
+                    validator.updateStatus(spl[i], validator.STATUS_VALID, 'different');
             }
+            return isValid;
         }
     };
 }(window.jQuery));