Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

268
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda