Browse Source

form fix.

tags/2.0.0-beta
Qiang Xue 12 years ago
parent
commit
7d999b2652
  1. 4
      framework/assets/yii.activeForm.js
  2. 2
      framework/widgets/ActiveField.php

4
framework/assets/yii.activeForm.js

@ -360,7 +360,7 @@
attribute.status = 1;
if ($input.length) {
hasError = messages && $.isArray(messages[attribute.id]) && messages[attribute.name].length;
hasError = messages && $.isArray(messages[attribute.name]) && messages[attribute.name].length;
var $container = $form.find(attribute.container);
$container.removeClass(
data.settings.validatingCssClass + ' ' +
@ -369,7 +369,7 @@
);
if (hasError) {
$form.find(attribute.error).html(messages[attribute.name][0]);
$container.find(attribute.error).html(messages[attribute.name][0]);
$container.addClass(data.settings.errorCssClass);
} else if (attribute.enableAjaxValidation || attribute.enableClientValidation && attribute.validate) {
$container.addClass(data.settings.successCssClass);

2
framework/widgets/ActiveField.php

@ -65,7 +65,7 @@ class ActiveField extends Component
$attribute = Html::getAttributeName($this->attribute);
$validators = array();
foreach ($this->model->getValidators($attribute) as $validator) {
foreach ($this->model->getActiveValidators($attribute) as $validator) {
/** @var \yii\validators\Validator $validator */
if (($js = $validator->clientValidateAttribute($this->model, $attribute)) != '') {
$validators[] = $js;

Loading…
Cancel
Save