user3574492
user3574492

Reputation: 6435

Laravel blade form closing issue

I have a form in Laravel like this:

    <div class="modal-body">
          {!! Form::model($questionGroup, ['route' => ['question_groups.update', $questionGroup->id, 'model_slug' => 'assessments', 'model_id' => $assessment->id], 'method' => 'patch']) !!}
          <p>TEST</p>
          {!! Form::close() !!}
    </div>

This outputs the following in my source:

<div class="modal-body">
   <form method="POST" action="http://localhost:8000/admin/question_groups/7?model_slug=assessments&amp;model_id=1" accept-charset="UTF-8"></form>
   <input name="_method" type="hidden" value="PATCH">
   <input name="_token" type="hidden" value="E6HzCmQvRGds6eETgdCv5KCsf0eyOtjxvqnidrTx">
   <p>TEST</p>
</div>

I have no idea why the form is not closing properly. Any ideas? I'm using Laravel 5.5 and this form is in a Bootstrap Modal.

EDIT:

Here is a link to the full html: https://gist.github.com/shabaz-ejaz/96be7b4b20ba9146436f1f9f1d274211

The file is quite big so search for question_groups.update and that is where the form begins.

Upvotes: 3

Views: 3379

Answers (1)

user3574492
user3574492

Reputation: 6435

The issue was related to non well-formed HTML.

My modal was inside a table like this:

<table>
   <tbody>
       <tr>
        <td></td>
        <td></td>
       </tr>

        <form ...>

        </form>

    </tbody>
</table>

Once I placed the <form> inside the <td> it worked fine.

Upvotes: 6

Related Questions