Я пытаюсь реализовать удаление подтверждения с помощью модального bootstrap 4 в моем проекте laravel. Когда модальный режим открыт, кнопка отправки не работает, я проверил браузер и показал, что мой конечный тег формы не был закрыт там, где я был размещен, конечный тег формы размещен точно после начального тега формы. Я не нахожу проблемы. Я проверил все в своем коде. Может, кто-нибудь поможет мне решить эту проблему?
index.blade.php
<div class = "panel-body">
<table id = "example" class = "table table-striped table-bordered" style = "width:100%">
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>Address</th>
<th>Blood Group</th>
<th>Type</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@forelse($patients as $patient)
<tr>
<td>{{ $loop-> index + 1 }}</td>
<td>{{ $patient->name }}</td>
<td>{{ $patient->address }}</td>
<td>{{ $patient->blood_group }}</td>
<td>{{ $patient->type_rh }}</td>
<td>
<a href = "{{ url('admin/patient/'.$patient->id.'/details') }}" target = "_blank">
<i class = "fa fa-eye" style = "color:#006400"></i>
</a>
<a href = "{{ url('admin/patient/'.$patient->id.'/edit') }}">
<i class = "fa fa-edit" style = "color:#e64980"></i>
</a>
<a href = "#" data-toggle = "modal" data-target = "#deletePatient-{{ $patient->id }}">
<i class = "fa fa-trash" style = "color:#cc3300"></i>
</a>
<a href = "{{ url('admin/patient/pdf/'.$patient->id) }}" class = "btn btn-primary pull-right"><i class = "fas fa-file-pdf"></i> PDF</a>
</td>
<!-- Delete Modal -->
<div class = "modal fade" id = "deletePatient-{{ $patient->id }}" tabindex = "-1" role = "dialog" aria-labelledby = "exampleModalLabel1">
<div class = "modal-dialog" role = "document">
<div class = "modal-content">
<div class = "modal-header">
<button type = "button" class = "close" data-dismiss = "modal" aria-label = "Close"><span aria-hidden = "true">×</span></button>
<h4>Confirm Delete</h4>
</div>
<form action = "{{ url('admin/patient/'.$patient->id.'/delete') }}" method = "POST">
{{ csrf_field() }}
{{ method_field('DELETE') }}
<div class = "modal-body">
<p>Are you sure want to delete this?</p>
</div>
<div class = "modal-footer">
<button type = "button" class = "btn btn-default" data-dismiss = "modal">Close</button>
<button type = "button" class = "btn btn-danger">Delete</button>
</div>
</form>
</div>
</div>
</div>
</tr>
@empty
@endforelse
</tbody>
<tfoot></tfoot>
</table>
</div>



![Безумие обратных вызовов в javascript [JS]](https://i.imgur.com/WsjO6zJb.png)


Это связано с тем, что ваш DIV, содержащий FORM должен, должен быть помещен в TD, если вы хотите, чтобы он находился внутри TABLE.
Вы не можете просто случайным образом поместить div в таблицу - он не будет действовать так же, как TR или TD, и вы получите такие ошибки из-за неправильного HTML.
Примечание:
Только 2 способа правильно использовать формы в таблице:
<form>
<table>...</table>
</form>
а также
<table>
...
<tr>
...
<td>
<form>...</form>
</td>
...
</tr>
...
</table>
Замените тип кнопки, как показано ниже
<form action = "{{ url('admin/patient/'.$patient->id.'/delete') }}" method = "POST">
{{ csrf_field() }}
{{ method_field('DELETE') }}
<div class = "modal-body">
<p>Are you sure want to delete this?</p>
</div>
<div class = "modal-footer">
<button type = "button" class = "btn btn-default" data-dismiss = "modal">Close</button>
<button type = "submit" class = "btn btn-danger">Delete</button>
</div>
</form>
Кнопка отправки должна быть такой, как показано ниже
<button type = "submit" class = "btn btn-danger">Delete</button>
в PHP сделать это так:
$modalcontent .= '
<div class = "modal fade" id = "modal_'.$modalid.'">
<div class = "modal-dialog">
<div class = "modal-content">
</div></div</div>';
echo '<tr><td></td><td></td></tr>';
$modalcontent .= '
<div class = "modal fade" id = "modal_'.$modalid.'">
<div class = "modal-dialog">
<div class = "modal-content">
</div></div</div>';
echo '<tr><td></td><td></td></tr>';
$modalcontent .= '
<div class = "modal fade" id = "modal_'.$modalid.'">
<div class = "modal-dialog">
<div class = "modal-content">
</div></div</div>';
echo '<tr><td></td><td></td></tr>';
..
</tbody></table>
//And now just do:
echo $modalcontent; //-> this will shift all modals out of the table.