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:
Alex-Code
2014-12-03 17:14:53 +00:00
committed by Qiang Xue
parent f85e8f9901
commit a43833544b

View File

@ -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) {