Browse Source

Fixes #928: client validation should be applied to active attributes only.

tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
d03d681583
  1. 6
      framework/yii/widgets/ActiveField.php

6
framework/yii/widgets/ActiveField.php

@ -589,9 +589,13 @@ class ActiveField extends Component
*/
protected function getClientOptions()
{
$attribute = Html::getAttributeName($this->attribute);
if (!in_array($attribute, $this->model->activeAttributes(), true)) {
return array();
}
$enableClientValidation = $this->enableClientValidation || $this->enableClientValidation === null && $this->form->enableClientValidation;
if ($enableClientValidation) {
$attribute = Html::getAttributeName($this->attribute);
$validators = array();
foreach ($this->model->getActiveValidators($attribute) as $validator) {
/** @var \yii\validators\Validator $validator */

Loading…
Cancel
Save