モーダル検証した後にのみ提出します。 そして、私は現在のアイテムフォームは、私は私のフォームを作成する<a href="https://laravelcollective.com/docs/5.4/html" rel="nofollow noreferrer">this package</a>を使用してい
{!! Form::open(['method' => 'delete', 'url' => route($entity.'.destroy', [$entity => $id]), 'style' => 'display: inline', 'onSubmit' => 'confirm("Do you really want to delete that?")']) !!}
<button type="submit" class="btn-delete btn btn-xs btn-danger">
<i class="glyphicon glyphicon-trash"></i>
</button>
{!! Form::close() !!}
のsuppresionを確認するために、このコードを使用していますこれは正常に動作しますが、私はこの醜いJSは、だから私はこの
を試してみましたモーダルによって確認交換したいと思います
{!! Form::open(['method' => 'delete', 'url' => route($entity.'.destroy', [$entity => $id]), 'style' => 'display: inline', 'onSubmit' => '$("#modal_' . $id. '").modal("show");']) !!}
<button type="submit" class="btn-delete btn btn-xs btn-danger">
<i class="glyphicon glyphicon-trash"></i>
</button>
{!! Form::close() !!}
<!-- Modal -->
<div id="modal_{{ $id }}" class="modal fade" role="dialog">
<div class="vertical-alignment-helper">
<div class="modal-dialog vertical-align-center">
<div class="modal-content">
<div class="modal-body">
<button type="button" class="close" data-dismiss="modal">×</button>
<p>You are about to delete.</p>
<p>Do you want to proceed?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary pull-left" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-danger">
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span> Confirm
</button>
</div>
</div>
</div>
</div>
</div>
しかし、アイテムがモーダル上の任意のクリックする前に削除されます。
このパッケージを使用してモーダルを適切にトリガーすることは可能ですか、古い学校のhtmlフォームを作成するだけですか?
? – zack6849
@ zack6849それは解決策になるかもしれませんが、この種の機能が 'laravelcollective/html'で可能かどうかを尋ねています...そうでなければ、AJAXの解決策に挑戦します! – Raccoon