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

266
Visualizações
Custom error doesn't show in form after using novalidate laravel

I am new to laravel, and I just implemented form validation. I have set custom error messages in different languages for each error which worked fine before putting <... class="needs-validation" novalidate>. Now my custom error message won't show.

Here is the code I use for my form:

<form method="POST" action="{{ route('users.store')}}" class="needs-validation" novalidate>
                            @csrf
                            <div class="form-group mb-3 ">
                                <label for="first_name" class="form-label">{{__('users.First Name')}}</label>
                                <div>
                                    <input name="first_name" id="first_name" class="form-control @error('first_name') is-invalid @enderror" placeholder="{{__('users.First Name')}}" value="{{ old('first_name') }}" required>
                                    @error('first_name')
                                    <span class="invalid-feedback">
                                        <strong>                                   
                                            {{ $message }}
                                        </strong>
                                    </span>
                                    @enderror
                                </div>
                            </div>
                            <div class="form-footer">
                                <button type="submit" class="btn btn-primary">{{ __('general.Add') }}</button>
                            </div>
</form>

It just doesn't go inside the @error('first_name) function.

I also use this for my javascript (from the official website):

<script>
   (function () {
  'use strict'

  // Fetch all the forms we want to apply custom Bootstrap validation styles to
  var forms = document.querySelectorAll('.needs-validation')

  // Loop over them and prevent submission
  Array.prototype.slice.call(forms)
    .forEach(function (form) {
      form.addEventListener('submit', function (event) {
        if (!form.checkValidity()) {
          event.preventDefault()
          event.stopPropagation()
        }

        form.classList.add('was-validated')
      }, false)
    })
})()
    
    </script>
about 4 years ago · Santiago Gelvez
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