mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 13:58:55 +08:00
Fix client-side trim validator.
Subsequent validators now use the trimmed value instead of the original value. fixes #7707
This commit is contained in:
@ -4,6 +4,7 @@ Yii Framework 2 Change Log
|
|||||||
2.0.5 under development
|
2.0.5 under development
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
- Bug #7707: client-side `trim` validator now passes the trimmed value to subsequent validators (nkovacs)
|
||||||
- Bug #8322: `yii\behaviors\TimestampBehavior::touch()` now throws an exception if owner is new record (klimov-paul)
|
- Bug #8322: `yii\behaviors\TimestampBehavior::touch()` now throws an exception if owner is new record (klimov-paul)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -237,8 +237,10 @@ yii.validation = (function ($) {
|
|||||||
var $input = $form.find(attribute.input);
|
var $input = $form.find(attribute.input);
|
||||||
var value = $input.val();
|
var value = $input.val();
|
||||||
if (!options.skipOnEmpty || !pub.isEmpty(value)) {
|
if (!options.skipOnEmpty || !pub.isEmpty(value)) {
|
||||||
$input.val($.trim(value));
|
value = $.trim(value);
|
||||||
|
$input.val(value);
|
||||||
}
|
}
|
||||||
|
return value;
|
||||||
},
|
},
|
||||||
|
|
||||||
captcha: function (value, messages, options) {
|
captcha: function (value, messages, options) {
|
||||||
|
|||||||
@ -89,6 +89,6 @@ class FilterValidator extends Validator
|
|||||||
|
|
||||||
ValidationAsset::register($view);
|
ValidationAsset::register($view);
|
||||||
|
|
||||||
return 'yii.validation.trim($form, attribute, ' . json_encode($options, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . ');';
|
return 'value = yii.validation.trim($form, attribute, ' . json_encode($options, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . ');';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user