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

113
Views
Display warning message in an HTML form

I have a regex type of field (^\d+.\d+.\d+$) in an HTML form. If a user enters any of the following versions below, we need the field to display a warning message. Is this possible?

  • 4.0.x to 4.5.6
  • 4.9.9
  • 4.9.11
  • 5.1.0
  • 6.x.x
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

function fx(inp){
    string = inp.value;
    regex = /^\d+.\d+.\d+$/;
    msg = 'your message';
    if (regex.test(string)&&inrange(string)){
      alert(msg);
    }       
}
    
function inrange(string){
  ver = string.split('.').map(v => parseInt(v));
  if (['4.9.9', '4.9.11','5.1.0'].includes(string)){return true;}
  if (ver[0] == 6){return true;}
  if((ver[0] == 4)){
    if(ver[1] < 5){return true;}
    if((ver[1]==5)&&(ver[2]<=6)){return true;}
  }
  return false;
}
<input type='text' onfocusout='fx(this)'>

Yes, it is possible.

You just need to:

  1. Trigger JavaScript function (e.g. onchange, onfocusout, onblur...) in the input tag.
  2. Check the input value against your regex and other criteria.
  3. Prompt your warning message accordingly.
about 4 years ago · Juan Pablo Isaza Report
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!