Fixes issue #588: Added afterValidate to ActiveForm.

This commit is contained in:
Qiang Xue
2013-06-29 17:48:11 -04:00
parent 1a02a4d51e
commit c0746f0689
2 changed files with 44 additions and 0 deletions

View File

@@ -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;