Bug #15826: Fixed JavaScript compareValidator in yii.validation.js for attributes not in rules (mgrechanik)

This commit is contained in:
Mikhail
2018-07-19 07:19:32 +03:00
committed by Alexander Makarov
parent 71424a42fa
commit 1ad85c640b
4 changed files with 8 additions and 12 deletions

View File

@ -274,12 +274,11 @@ yii.validation = (function ($) {
if (options.compareAttribute === undefined) {
compareValue = options.compareValue;
} else {
var attributes = $form.data('yiiActiveForm').attributes
for (var i = attributes.length - 1; i >= 0; i--) {
if (attributes[i].id === options.compareAttribute) {
compareValue = $(attributes[i].input).val();
}
var $target = $('#' + options.compareAttribute);
if (!$target.length) {
$target = $form.find('[name="' + options.compareAttributeName + '"]');
}
compareValue = $target.val();
}
if (options.type === 'number') {