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

138
Visualizações
JavaScript native form abilities

Say I have form with 2 inputs (email and password) that the user submits. onSubmit I process the form with a fetch call, catch the errors and need to display it back to the user. ie. an error such as "The email address you provided does not exist". So basically a typical login form. I'd like to display this message to the user via the native form warning displays.

I see there's a way to set the inputs custom message with setCustomValidity but I'm not sure how to display the message again once I've determined there's an error.

After some research I've determined that I have to apparently resubmit the form to display the custom error. Other sites claim that I can do it directly. It's rather confusing.

So the question is how can I set then instantly display a custom input error to take advantage of native form validation?

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