renderPartial clientSide validation не работает. Я хочу сделать часть формы с помощью ajax. Напр .: _form.phpYii2 renderPartial clientSide validation не работает
$form = ActiveForm::begin([
'options' => [
'enableAjaxValidation' => true,
]
]);
$form->field($model, 'category_id')->dropDownList($category, [
'onchange'=>'
$.get("'.Url::toRoute('/controller/params').'", { id: $(this).val() })
.done(function(data) {
$("#offers-param-content").html(data);
}
);'
]);
Controller.php
public function actionParams($id)
{
$model = new Param();
$params = EavAttribute::find()->where(['category_id'=>$id])->all();
$this->renderPartial('_params', ['model' => $model, 'params' => $params];
}
_params.php
foreach($params as $item){
echo Html::activeTextInput('text', $model, $item->name);
}
вы пробовали uisng [renderAjax() ] (http://www.yiiframework.com/doc-2.0/yii-web-view.html#renderAjax%28%29-detail)? –
@InsaneSkull Да – user3185208