mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-01 03:26:36 +08:00
Fixes #6361: Added validateAttribute() to yii.activeForm.js to support manually triggering data validation of an input
This commit is contained in:
@ -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)
|
- 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 #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 #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 #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 #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)
|
- 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;
|
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 an attribute config based on the specified attribute ID
|
||||||
find: function (id) {
|
find: function (id) {
|
||||||
var attributes = $(this).data('yiiActiveForm').attributes,
|
var attributes = $(this).data('yiiActiveForm').attributes,
|
||||||
@ -251,6 +259,7 @@
|
|||||||
return this.data('yiiActiveForm');
|
return this.data('yiiActiveForm');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// validate all applicable inputs in the form
|
||||||
validate: function () {
|
validate: function () {
|
||||||
var $form = $(this),
|
var $form = $(this),
|
||||||
data = $form.data('yiiActiveForm'),
|
data = $form.data('yiiActiveForm'),
|
||||||
@ -413,9 +422,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$input.on('forceValidate.yiiActiveForm', function() {
|
|
||||||
validateAttribute($form, attribute, true);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var unwatchAttribute = function ($form, attribute) {
|
var unwatchAttribute = function ($form, attribute) {
|
||||||
|
|||||||
Reference in New Issue
Block a user