Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

122
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!