How to switch on\off frontend form validation for some fields in yii2?

后端 未结 6 1355
滥情空心
滥情空心 2021-02-19 23:26

I have got difficult form in yii2 view, where some fields show or hide. It decide from user field choises, select options in the form. I write this frontend logic with custom jq

6条回答
  •  闹比i
    闹比i (楼主)
    2021-02-19 23:59

    You can set your active field using this code: (not active record, activefield exactly)

    $activeField = $form->field($model, 'someField');
    $activeField->enableClientValidation=false;
    $activeField ->enableAjaxValidation=false;
    

提交回复
热议问题