E
E
Evgeny Milushkin2015-07-15 09:28:25
Yii
Evgeny Milushkin, 2015-07-15 09:28:25

Pjax with ActiveForm, inside ActiveForm perhaps?

Hello! Tell me , please,
There is a form (ActiveForm) of model1 on the page.
Inside this form is a pjax block with another ActiveForm form for adding information to model2.
When the model2 form submits, pjax is not processed and the model1 form submit occurs.
Tell me how to implement correctly? Or is it wrong to do so?

$form1 = ActiveForm::begin();
   Pjax::begin(['id' => 'notes']);
     $form2 = ActiveForm::begin(['action' => '/note/save', 'options' => ['data-pjax' => '1']]);
        $form2->field($notes, 'text')->textarea(['rows' => 3]);
        Html::submitButton('Add', ['data-pjax' => '1'])
     ActiveForm::end();
   Pjax::end()
ActiveForm::end();

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Makarov, 2015-07-15
@evgenmil

Nested forms are against the HTML standard.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question