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

202
Vistas
How to stop update on keyup if the error message is the same with Jquery validate

Whenever I type in Jquery validated field on max and min number of letters, I get a refresh of messages even though the error is the same. How do I prevent that so it is less irritating for the users?

The code is

    validations = {
        'rules':{
            'code': {
                'minlength': 9,
                'maxlength': 9
            },

        },
        'messages': {
            'code': {
                'minlength': 'Must be 9 digits',
                'maxlength': 'Must be 9 digits'
            },
        }
    }

I have tried to use showerror(), and check whether the error list is the same, but I can't prevent the previous error messages from disappearing.

        showErrors: function(errorMap, errorList) {
            if(typeof prev_error_map != "undefined"){
                if (!_.isEqual(prev_error_map, errorMap)) {
                    this.defaultShowErrors();
                    prev_error_map = errorMap;
                }
            }else{
                this.defaultShowErrors();
                prev_error_map = errorMap;
            }
        }
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

So I figured out my mistake. Instead of doing

'minlength': x,
'maxlength': y

I should have done

'rangelength': [x,y]

This way, the length is only checked once and potential updates are avoided.

about 4 years ago · Juan Pablo Isaza Denunciar
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