Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

311
Visualizações
Form Error Messages Are Not Displayed Laravel 5

I'm new at Laravel and I want to Use the authentification system included in Laravel. To do so I activated authentification in my laravel projet with

php artisant make:auth

Then I tryed to log in in the my projet and everthing works but the error messages like "e-mail field is required" aren't shown when I submit the empty form.

Here is an example of the error test auto implemented in my login.blade.php :

<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
          <div class="col-md-12">
              <input id="email" type="email" class="form-control" placeholder="{{ trans('validation.attributes.email') }}" name="email" value="{{ old('email') }}" required autofocus>

              @if ($errors->has('email'))
                  <span class="help-block">
                      <strong>{{ $errors->first('email') }}</strong>
                  </span>
              @endif
          </div>
</div>

Please notice that when I enter a bad combinaison of email/password the error message is shown correctly but for any other case the page doesn't even refresh.

Thank you for your help ...

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You input email field is required. Your browser probably does not submit the request because of this. If you remove the "require" attribute from your email input, the error should be shown.

<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
      <div class="col-md-12">
          <input id="email" type="email" class="form-control" placeholder="{{ trans('validation.attributes.email') }}" name="email" value="{{ old('email') }}" autofocus>

          @if ($errors->has('email'))
              <span class="help-block">
                  <strong>{{ $errors->first('email') }}</strong>
              </span>
          @endif
      </div>

Also, you can use this code to show "all" errors when they occur:

@if (count($errors) > 0)
    <div class="alert alert-danger">
        <strong>Whoops!</strong><br><br>
        <ul>
            @foreach ($errors->all() as $error)
                <li>{{ $error }}</li>
            @endforeach
        </ul>
    </div>
@endif
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda