S
S
Sergey2015-05-18 03:18:06
Yii
Sergey, 2015-05-18 03:18:06

Why does the form tag in my code close immediately, but after the closed form there are fields?

There is code at the end of the table that makes a line with the form fields:

<? $form = ActiveForm::begin(['id' => 'addextra-form']); ?>
  <tr class="addextra-tr"><td>

      <?=$form->field($model,'question')->label('Question:');?>
    </td>
    <?	foreach ($analyse as $anal) { ?>
        <td>
        <?=$form->field($model,'scores[0]['.$anal['login_id'].']')->label('Points:');?>
        </td>
    <?	} ?>
  </tr>
    <? $length = count($analyse); ?>
  <tr><td colspan="<?=$length?>"></td>
      <td>
      <?=Html::submitButton('Save Extra Questions', ['class' => 'btn btn-primary extra-btn']);?>
  </td></tr>
  <?ActiveForm::end();?>
  
</table>

The table is built correctly and all the fields are in it the way I want to see it. But the form closes immediately. Why?
Those. the result looks like this:
<form id="addextra-form" method="post" action="/index.php?r=tender/analyse&action=all&id=56"></form>

And after that comes the rest of the result.
I tried to do everything in one php script, outputting html tags via echo, the result is the same.
Why is this happening?
22bbac45acd24e48bc13907799648090.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
_
_ _, 2015-05-18
@butteff

Because it is not necessary to put tr in form.
Wrap the entire table in a form.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question