Hi, i have a form with 2 different models, and 1 of these models can have multiple rows inside the form.
I managed to do that with this code called by a button firing an ajax action:
ob_start(); $form = ActiveForm::begin(); ob_get_clean();
ob_start(); ActiveForm::end(); ob_get_clean();
return $this->renderAjax('_foo', [
'model' => $model,
'form' => $form,
'index' => $index,
The foo view:
<?= $form->field($model, "[$index]field_name")->textInput()->label(FALSE) ?>
This works fine, i can submit the form and get the input inside the Post.
While the first row does it, every row added with Ajax doesn’t.
I tried adding enableAjaxValidation, enableClientValidation ecc. to the form and to the fields, but it doesn’t work either.
How can i do that?
Another question, where can i find the documentation for yii.activeForm.js ?
Thanks in advance
render the activeform in the view page and hide it.
whenever you require the form, instead of ajax, show it using jquery etc.
Yeah, i noticed that.
Yeah, it’s a solution, but i’d have to use a fixed number of rows.
I want to let the user add any number of rows.