Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6037473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:04:45+00:00 2026-05-23T06:04:45+00:00

So I have a form, but I don’t need to be submitting the information

  • 0

So I have a form, but I don’t need to be submitting the information to the server just yet… What I need, is to just run the fields through the HTML5 built-in validation conditions (such as email, etc.), and if true, just execute a specific function…

So far, I’ve come up with this…

function checkform()
{
    var /* all the elements in the form here */

    if (inputElement.validity.valid == 'false')
    {
        /* Submit the form, 
        this will cause a validation error, 
        and HTML5 will save the day... */
    } else
    {
        navigateNextStep();
    }
}

That’s the logic I’ve come up with so far, and its a little backhanded because I’m submitting KNOWING that there’s an invalid value, hence triggering the validation prompts…

My only problem with the above logic, is that I have about, 7-8 input elements, and I find the option of doing the following rather, ‘dirty’:

var inputs = document.getElementsByTagName("INPUT");
if (!inputs[0].validity.valid && !inputs[1].validity.valid && ...)

Ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T06:04:46+00:00Added an answer on May 23, 2026 at 6:04 am

    You can just call formEl.checkValidity()… This will return a boolean indicating whether or not the whole form is valid, and throw appropriate invalid events otherwise.

    The spec

    A brief JSFiddle to play with

    I’m not sure how you’re expecting submitting the form to trigger the browser’s validation UI, though. Calling formEl.submit() seems to result in a submission regardless of the validation state. This is noted at the bottom of The H5F project page, which says:

    Safari 5, Chrome 4-6 and Opera 9.6+ all block form submission until all form control validation
    constraints are met.

    Opera 9.6+ upon form submission will focus to the first invalid field
    and bring up a UI block indicating
    that it is invalid.

    Safari 5.0.1, and Chrome 7 have removed form submission blocking if a
    form is invalid, most likely due to
    legacy forms now not submitting on
    older sites.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have model with ManyToManyField. Now I need form but don't need select field
I have a form that I don't render as part of HTML page but
I would like to use formtastic to create form but I don't have a
I have a form with a bunch of tabs on it, but I don't
I have a form in which some of the fields need to be validated
I have 5 links that are on the same form but I would like
Ok, I have a validation script that checks everything on the form - but
I have found the Form.TopMost property but it puts the form on top of
I have a form with an initial value, but I can't get the initial
I have a form element that I want to address via javascript, but it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.