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

137
Views
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
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!