Problems sending form in modal bootstrap

0

Hello, I am sending a form that is in a modal within a page, but the modal simply does not send, it is inside a page that is a return of an ajax (a search in the case), I do not know if it influences .

<div class="modal fade" id="finalizarMonitoramento{{$m->ID_CD_INTERNACAO}}" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered" role="document">
      <div class="modal-content">
        <div class="modal-header">
          <h5 class="modal-title" id="exampleModalLongTitle">Modal title</h5>
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>
        <div class="modal-body">
        <form action="{{url('monitoramento/finalizaMonitoramento')}}" method="post">
        <input type="hidden" value="{{$m->ID_CD_MONITORAMENTO}}" id="id_mot" name="id_mot">
           @method('PUT')
           @csrf
          <input type="submit" class="btn btn-primary" value="enviar">
        </form>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>

        </div>

      </div>
    </div>
  </div> 

This is the modal, when I send simply nothing happens. Any tips?

This is the route:

Route::put('/finalizaMonitoramento','MonitoramentoController@finalizaMonitoramento');
    
asked by anonymous 13.08.2018 / 19:06

1 answer

0

An alternative to this would be to use Laravel Collective ( link ), because I imagine the problem as already mentioned in the comments be the Token.

  

PS: The laravel collective needs to be installed as seen    this link .

Example of what Form would look like:

<div class="modal fade" id="finalizarMonitoramento{{$m->ID_CD_INTERNACAO}}" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
  <div class="modal-content">
    <div class="modal-header">
      <h5 class="modal-title" id="exampleModalLongTitle">Modal title</h5>
      <button type="button" class="close" data-dismiss="modal" aria-label="Close">
        <span aria-hidden="true">&times;</span>
      </button>
    </div>
    <div class="modal-body">
    {!! Form::open(['url' => 'monitoramento/finalizaMonitoramento', 'method' => 'POST']) !!}
     {{Form::hidden('_method','PUT')}}
     {{Form::hidden('id_mot', $m->ID_CD_MONITORAMENTO, 'id' => 'id_mot')}}
      {{Form::submit('enviar', ['class'=>'btn btn-primary'])}}
    {!! Form::close() !!}
    </div>
    <div class="modal-footer">
      <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
    </div>
  </div>
</div>

Remembering that {{Form::hidden('_method','PUT')}} was entered to show that this request is PUT type.

I hope I have helped.

    
20.08.2018 / 21:02