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

后端 未结 6 1554
傲寒
傲寒 2021-02-20 01:44

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-20 01:48

    $form->field($model, 'youAttribute', ['enableClientValidation' => false])->textInput();
    

    The ActiveField class has a property enableClientValidation, you can simply set this property to false if you want to disable clientValidation form some fields.

提交回复
热议问题