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

284
Views
how to submit form after calling e.preventDefault()

form.addEventListener('submit', e => {
    e.preventDefault();
    validateInputs();


});

how to submit the form in given js

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

It is not very clear from your question, but I will make this assumption:

  • I will assume that the function validateInputs returns true if all the inputs are considered valid, and returns false if there is one or more error found in the form inputs.

You can call form.submit() to programmatically submit the form.

In the context of your existing code, applying the assumption I've listed above:

form.addEventListener('submit', e => {
    e.preventDefault();

    if (validateInputs()) {
        // All inputs are valid, submit the form.
        form.submit();
    } else {
        // Run some code here that points out the problems in the form
    }
});

about 4 years ago · Juan Pablo Isaza Report

0

find your submit button and add click event

function checkForm()
{
   if(validateInputs())
   {
      form.submit();
   }
}
button.addEventListener("click",checkForm);
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!