title: Keep modal open and showing error laravel
body: <p>Yes, I saw the other two post on this question unfortunately I still could not get it working, my modal still closes, how o I keep my modal open while showing the erors? am I missing out on something?</p>
  
  <p>Controller:</p>
  
  <pre><code>// check if the validator failed -----------------------
          if ($validator-&gt;fails()) {
  
          // get the error messages from the validator
              $messages = $validator-&gt;messages();
  
          // redirect our user back to the form with the errors from the validator
              $input = Input::except('password', 'password_confirm'); //Get all the old input except password.
              $input['autoOpenModal'] = 'true'; //Add the auto open indicator flag as an input.
              return Redirect::back()
              -&gt;withErrors($validator)
              -&gt;withInput($input);
  
          } else {
  </code></pre>
  
  <p>Blade.php:</p>
  
  <pre><code>  &lt;!-- Modal --&gt;
    &lt;div id="register" class="modal fade" id="remoteModal" role="dialog"&gt;
       &lt;div class="modal-dialog"&gt;
  
          &lt;!-- Modal content--&gt;
          &lt;div class="modal-content"&gt;
             &lt;div class="modal-header"&gt;
                &lt;button type="button" class="close" data-dismiss="modal"&gt;&amp;times;&lt;/button&gt;
                &lt;h4 class="modal-title"&gt;New User&lt;/h4&gt;
            &lt;/div&gt;
            &lt;div class="modal-body"&gt;
                &lt;form class="form-horizontal" role="form" method="POST" action="/manage_accounts" novalidate&gt;
                 &lt;input type="hidden" name="_token" value="{{ csrf_token() }}"&gt;
                 &lt;div class="form-group"&gt;
                  &lt;label class="control-label col-sm-3" for="name"&gt;Username:&lt;/label&gt;
                  &lt;div class="col-sm-5"&gt; 
                     &lt;input type="text" class="form-control" type="hidden" id="name" name="name" placeholder="Enter username"&gt;
                     @if ($errors-&gt;has('name')) &lt;p class="help-block"&gt;{{ $errors-&gt;first('name') }}&lt;/p&gt; @endif
                 &lt;/div&gt;
             &lt;/div&gt;
             &lt;div class="form-group"&gt;
              &lt;label class="control-label col-sm-3" for="password"&gt;Password:&lt;/label&gt;
              &lt;div class="col-sm-5"&gt; 
                 &lt;input type="password" class="form-control" type="hidden" id="password" name="password" placeholder="Enter login password"&gt;
             &lt;/div&gt;
         &lt;/div&gt;
         &lt;div class="form-group"&gt;
          &lt;label class="control-label col-sm-3" for="password_confirm"&gt;Confirm Password:&lt;/label&gt;
          &lt;div class="col-sm-5"&gt; 
             &lt;input type="password" class="form-control" type="hidden" id="password_confirm" name="password_confirm" placeholder="Re-type password again"&gt;
         &lt;/div&gt;
     &lt;/div&gt;
     &lt;div class="form-group"&gt;
      &lt;label class="control-label col-sm-3" for="email"&gt;Email:&lt;/label&gt;
      &lt;div class="col-sm-5"&gt; 
         &lt;input type="email" class="form-control" type="hidden" id="email" name="email" placeholder="Enter email address"&gt;
     &lt;/div&gt;
  &lt;/div&gt; 
  &lt;div class="form-group"&gt;
      &lt;label class="control-label col-sm-3" for="mobile"&gt;Phone Number:&lt;/label&gt;
      &lt;div class="col-sm-5"&gt; 
         &lt;input type="hpnum" class="form-control" type="hidden" id="mobile" name="mobile" placeholder="Enter handphone number"&gt;
     &lt;/div&gt;
  &lt;/div&gt;
   &lt;!--&lt;div class="form-group"&gt;
      &lt;label class="control-label col-sm-3" for="officeEx"&gt;Office Extension:&lt;/label&gt;
          &lt;div class="col-sm-5"&gt; 
              &lt;input type="officeEx" class="form-control" id="officeEx" placeholder="Enter office extension"&gt;
          &lt;/div&gt;
      &lt;/div&gt; --&gt;                                                                                                                     
     &lt;div class="form-group"&gt;
      &lt;label class="control-label col-sm-3" for="role_id"&gt;Role:&lt;/label&gt;
      &lt;div class="col-sm-5"&gt;
          &lt;select class="form-control" type="hidden" id="role_id" name="role_id"&gt;
              @foreach ($roles as $role)
              &lt;option value="{{ $role-&gt;id }}"&gt;{{ $role-&gt;role_description }}&lt;/option&gt;
              @endforeach
          &lt;/select&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="form-group"&gt; 
      &lt;div class="col-sm-offset-3 col-sm-5"&gt;
         &lt;button type="submit" class="btn btn-default"&gt;Register&lt;/button&gt;
     &lt;/div&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  &lt;div class="modal-footer"&gt;
    &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Close&lt;/button&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;script type="text/javascript"&gt;
       if ({{ Input::old('autoOpenModal', 'false') }}) {
          //JavaScript code that open up your modal.
          $('#remoteModal').modal('show');
      }
  &lt;/script&gt;
  </code></pre>