Commit b1ba2439 by Alexander Kochetov

[WIP] Additional RangeValidator fixes

parent 431d8864
...@@ -91,10 +91,19 @@ yii.validation = (function ($) { ...@@ -91,10 +91,19 @@ yii.validation = (function ($) {
if (options.skipOnEmpty && pub.isEmpty(value)) { if (options.skipOnEmpty && pub.isEmpty(value)) {
return; return;
} }
var valid = !options.not && $.inArray(value, options.range) > -1
|| options.not && $.inArray(value, options.range) == -1;
if (!valid) { var inArray = true;
$.each(value, function(i, v) {
if ($.inArray(v, options.range) == -1) {
inArray = false;
return false;
} else {
return true;
}
});
if (options.not !== inArray) {
pub.addMessage(messages, options.message, value); pub.addMessage(messages, options.message, value);
} }
}, },
......
...@@ -72,7 +72,7 @@ class RangeValidator extends Validator ...@@ -72,7 +72,7 @@ class RangeValidator extends Validator
} }
} }
return ($this->not xor $in) ? null : [$this->message, []]; return $this->not !== $in ? null : [$this->message, []];
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment