Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

115
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda