mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-19 07:50:39 +08:00
Fixes issue #588: Added afterValidate to ActiveForm.
This commit is contained in:
@@ -41,6 +41,9 @@
|
||||
// a callback that is called before validating each attribute. The signature of the callback should be:
|
||||
// function ($form, attribute, messages) { ...return false to cancel the validation...}
|
||||
beforeValidate: undefined,
|
||||
// a callback that is called after an attribute is validated. The signature of the callback should be:
|
||||
// function ($form, attribute, messages)
|
||||
afterValidate: undefined,
|
||||
// the GET parameter name indicating an AJAX-based validation
|
||||
ajaxVar: 'ajax'
|
||||
};
|
||||
@@ -333,6 +336,9 @@
|
||||
$input = findInput($form, attribute),
|
||||
hasError = false;
|
||||
|
||||
if (data.settings.afterValidate) {
|
||||
data.settings.afterValidate($form, attribute, messages);
|
||||
}
|
||||
attribute.status = 1;
|
||||
if ($input.length) {
|
||||
hasError = messages && $.isArray(messages[attribute.name]) && messages[attribute.name].length;
|
||||
|
||||
Reference in New Issue
Block a user