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

119
Vistas
form validating input numbers with conditions

i have a form i have a doubt on, it's on a user input where i need to apply this logic:

 <input type="number" name="num" placeholder="kmfim">

              <div id="error"></div>
<script>
    var numb=document.forms['myform']['num'];
    var error=document.getElementById('error');

    function validation()
    {
        if(numb.value == '')
        {
            alert("cannot be empty");
            error.innerHTML="Number field cannot be empty";
            error.style.display="block";
            return false;
        }
        if(numb.value < idkm)
        {
            alert("cant insert less then last time");
            error.innerHTML="cant insert less then last time";
            error.style.display="block";
        }
        return true;
    }
</script>

idkm its a place to store current idkm, and in the form the input kmfim will grab the kmfim and in my insert page i update the idkm with the kmfim inserted on this form thanks in advance

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