mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 04:37:42 +08:00
Update yii.activeForm.js
This commit is contained in:
@ -270,7 +270,22 @@
|
|||||||
});
|
});
|
||||||
}, data.settings.validationDelay);
|
}, data.settings.validationDelay);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array prototype with a shortcut method for adding a new deferred.
|
||||||
|
* The context of the callback will be the deferred object so it can be resolved like ```this.resolve()```
|
||||||
|
* @returns Array
|
||||||
|
*/
|
||||||
|
var deferredArray = function () {
|
||||||
|
var array = [];
|
||||||
|
array.add = function(callback) {
|
||||||
|
var deferred = new $.Deferred();
|
||||||
|
callback.call(deferred);
|
||||||
|
this.push(deferred);
|
||||||
|
};
|
||||||
|
return array;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs validation.
|
* Performs validation.
|
||||||
* @param $form jQuery the jquery representation of the form
|
* @param $form jQuery the jquery representation of the form
|
||||||
@ -281,7 +296,7 @@
|
|||||||
var data = $form.data('yiiActiveForm'),
|
var data = $form.data('yiiActiveForm'),
|
||||||
needAjaxValidation = false,
|
needAjaxValidation = false,
|
||||||
messages = {},
|
messages = {},
|
||||||
deferreds = [];
|
deferreds = deferredArray();
|
||||||
|
|
||||||
$.each(data.attributes, function () {
|
$.each(data.attributes, function () {
|
||||||
if (data.submitting || this.status === 2 || this.status === 3) {
|
if (data.submitting || this.status === 2 || this.status === 3) {
|
||||||
|
|||||||
Reference in New Issue
Block a user