Commit 4dcbe83a by Qiang Xue

Fixes #6361: Added `validateAttribute()` to `yii.activeForm.js` to support…

Fixes #6361: Added `validateAttribute()` to `yii.activeForm.js` to support manually triggering data validation of an input
parent a4383354
......@@ -12,6 +12,7 @@ Yii Framework 2 Change Log
- Bug #7074: `yii\data\ArrayDataProvider` did not correctly handle the case `Pagination::pageSize = 0` (kirsenn, qiangxue)
- Enh #5663: Added support for using `data-params` to specify additional form data to be submitted via the `data-method` approach (usualdesigner, qiangxue)
- Enh #6106: Added ability to specify `encode` for each item of `yii\widgets\Breadcrumbs` (samdark, aleksanderd)
- Enh #6361: Added `validateAttribute()` to `yii.activeForm.js` to support manually triggering data validation of an input (Alex-Code, qiang)
- Enh #6493: Added support for the `Access-Control-Expose-Headers` header by `yii\filters\Cors` (usualdesigner)
- Enh #6697: Added `yii\helpers\Url::current()` method that allows adding or removing parameters from current URL (samdark, callmez)
- Enh #6852: Added `yii\helpers\BaseHtmlPurifier::helpers()` in order to be able to configure `HtmlPurifier` helper globally via subclassing (Alex-Code)
......
......@@ -227,6 +227,14 @@
return attribute;
},
// manually trigger the validation of the attribute with the specified ID
validateAttribute: function (id) {
var attribute = methods.find(id);
if (attribute != undefined) {
validateAttribute($(this), attribute, true);
}
},
// find an attribute config based on the specified attribute ID
find: function (id) {
var attributes = $(this).data('yiiActiveForm').attributes,
......@@ -251,6 +259,7 @@
return this.data('yiiActiveForm');
},
// validate all applicable inputs in the form
validate: function () {
var $form = $(this),
data = $form.data('yiiActiveForm'),
......@@ -413,9 +422,6 @@
}
});
}
$input.on('forceValidate.yiiActiveForm', function() {
validateAttribute($form, attribute, true);
});
};
var unwatchAttribute = function ($form, attribute) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment