Browse Source

Merge branch 'master' of git.yiisoft.com:yii2

tags/2.0.0-beta
Qiang Xue 12 years ago
parent
commit
f6e3475653
  1. 8
      framework/assets/yii.activeForm.js
  2. 20
      framework/assets/yii.validation.js

8
framework/assets/yii.activeForm.js

@ -42,7 +42,7 @@
// the container CSS class representing the corresponding attribute has validation error
errorCssClass: 'error',
// the container CSS class representing the corresponding attribute passes validation
successCssClass: 'success',
successCssClass: 'success',
// the container CSS class representing the corresponding attribute is being validated
validatingCssClass: 'validating',
// a callback that is called before validating any attribute
@ -126,7 +126,7 @@
return this.each(function () {
$(window).unbind('.yiiActiveForm');
$(this).removeData('yiiActiveForm');
})
});
}
};
@ -220,7 +220,7 @@
/**
* Performs the ajax validation request.
* This method is invoked internally to trigger the ajax validation.
* @param form jquery the jquery representation of the form
* @param $form jquery the jquery representation of the form
* @param successCallback function the function to be invoked if the ajax request succeeds
* @param errorCallback function the function to be invoked if the ajax request fails
*/
@ -352,7 +352,7 @@
* updates the error message and the input container for a particular attribute.
* @param attribute object the configuration for a particular attribute.
* @param messages array the json data obtained from the ajax validation request
* @param form the form jQuery object
* @param $form the form jQuery object
* @return boolean whether there is a validation error for the specified attribute
*/
var updateInput = function ($form, attribute, messages) {

20
framework/assets/yii.validation.js

@ -27,7 +27,9 @@ yii.validation = (function ($) {
valid = true;
}
valid || messages.push(options.message);
if(!valid) {
messages.push(options.message);
}
},
boolean: function (value, messages, options) {
@ -37,7 +39,9 @@ yii.validation = (function ($) {
var valid = !options.strict && (value == options.trueValue || value == options.falseValue)
|| options.strict && (value === options.trueValue || value === options.falseValue);
valid || messages.push(options.message);
if(!valid) {
messages.push(options.message);
}
},
string: function (value, messages, options) {
@ -86,7 +90,9 @@ yii.validation = (function ($) {
var valid = !options.not && $.inArray(value, options.range)
|| options.not && !$.inArray(value, options.range);
valid || messages.push(options.message);
if(!valid) {
messages.push(options.message);
}
},
regularExpression: function (value, messages, options) {
@ -106,7 +112,9 @@ yii.validation = (function ($) {
var valid = value.match(options.pattern) && (!options.allowName || value.match(options.fullPattern));
valid || messages.push(options.message);
if(!valid) {
messages.push(options.message);
}
},
url: function (value, messages, options) {
@ -182,7 +190,9 @@ yii.validation = (function ($) {
break;
}
valid || messages.push(options.message);
if(!valid) {
messages.push(options.message);
}
}
};
})(jQuery);

Loading…
Cancel
Save