mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 13:02:24 +08:00
Attach forceValidate event to attributes
Allow attributes to have their validation triggered by a custom event. `validateAttribute` is called with `forceValidate` set to true.
This commit is contained in:
@ -395,7 +395,7 @@
|
||||
var watchAttribute = function ($form, attribute) {
|
||||
var $input = findInput($form, attribute);
|
||||
if (attribute.validateOnChange) {
|
||||
$input.on('change.yiiActiveForm',function () {
|
||||
$input.on('change.yiiActiveForm', function () {
|
||||
validateAttribute($form, attribute, false);
|
||||
});
|
||||
}
|
||||
@ -413,6 +413,9 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
$input.on('forceValidate.yiiActiveForm', function() {
|
||||
validateAttribute($form, attribute, true);
|
||||
});
|
||||
};
|
||||
|
||||
var unwatchAttribute = function ($form, attribute) {
|
||||
|
||||
Reference in New Issue
Block a user