Commit 2ec58e64 by Qiang Xue

Fixed whenClient.

parent 797b0430
...@@ -673,10 +673,10 @@ class ActiveField extends Component ...@@ -673,10 +673,10 @@ class ActiveField extends Component
foreach ($this->model->getActiveValidators($attribute) as $validator) { foreach ($this->model->getActiveValidators($attribute) as $validator) {
/** @var \yii\validators\Validator $validator */ /** @var \yii\validators\Validator $validator */
$js = $validator->clientValidateAttribute($this->model, $attribute, $this->form->getView()); $js = $validator->clientValidateAttribute($this->model, $attribute, $this->form->getView());
if ($validator->enableClientValidation && $js != '') {
if ($validator->whenClient !== null) { if ($validator->whenClient !== null) {
$js = "if ({$validator->whenClient}(attribute, value)) { $js }"; $js = "if ({$validator->whenClient}(attribute, value)) { $js }";
} }
if ($validator->enableClientValidation && $js != '') {
$validators[] = $js; $validators[] = $js;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment