1 year ago

Issue submitting form data from bootstrap 4 modal

Posted 1 year ago by MattB

I cannot get data to submit from a modal in laravel. When I use the below code and hit the 'add user' button, the modal just closes and doesn't seem to call the @store method in my controller. Data doesn't get submitted to the db

<div class="modal fade" id="addNew" tabindex="-1" role="dialog">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title">New User</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
      <div class="modal-body">
        {!! Form::open(['method' =>'POST', 'action'=> '[email protected]', 'files'=>true, 'enctype'=>'multipart/form-data']) !!}
        <div class="form-group {{$errors->has('firstName') ? 'has-error' : ''}}">
          {!! Form::label('firstName', 'First Name:') !!}
          {!! Form::text('firstName', null, ['class'=>'form-control', 'rows' => 3])!!}
{{--most form data removed for simplicity--}}
        <div class="form-group">
          {!! Form::submit('Add user', ['class'=>'btn btn-primary']) !!}
        {!! Form::close() !!}

Please sign in or create an account to participate in this conversation.