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 7724857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:47:39+00:00 2026-06-01T04:47:39+00:00

I am trying to validate a form with the jquery-validate plugin. The html page

  • 0

I am trying to validate a form with the jquery-validate plugin. The html page doesn’t show the error messages from the validation until I click submit twice. I know the submit event is being received on every click (including the first one) because I placed an alert in the javascript to verify.

I can also see the form is submitted because I see the parameters show up in the address bar after the first click. Do I have to do something to force the error messages to show up the first time?

Here how I’m adding the validation:

<script type="text/javascript">
$("form").submit(function() {
    $("form").validate({
        rules: {
            match: "required",
            limit: "required"
        },
        messages: {
            match: "Please enter a match"
        },
    });
});
</script>

Here is a snippet of my form:

<form action="#">
  <fieldset>
    <legend>Smart Playlist</legend>
    <div class="control-group">
      <label class="control-label">
      <input type="checkbox" name="match" value="match" class="chkbox"/>
      </label>
   </div>
  </fieldset>
</form>
  • 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-06-01T04:47:40+00:00Added an answer on June 1, 2026 at 4:47 am

    You do not need to enclose it within the .submit() handler because the Validation Plugin takes care of that already. Please refer to the official demo page for working examples.

    $(document).ready(function() {
    
        $("form").validate({
            rules: {
                match: "required",
                limit: "required"
            },
            messages: {
                match: "Please enter a match"
            } // <- removed trailing comma
        });
    
    });
    

    BTW- you also had a trailing comma after the messages: options. Certain versions of IE would choke on that. This is the “Trailing Comma of Death” and it only affects certain versions of IE… other browsers’ tools may not flag it as an error because it’s technically not an error.


    A more detailed explanation of what was happening:

    Since you enclosed .validate() within .submit(), the Validation function does not even load until you hit submit. Since it’s not already loaded when you hit submit, no validation will occur. Then when you hit submit the second time, the function is now loaded so it appears to work normally.

    When you enclose .validate() within document.ready, the Validation plugin loads immediately as the DOM is finished loaded. Therefore, it’s ready and waiting for you to interact with your form and it behaves correctly on the first submit.

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

Sidebar

Related Questions

I'm trying to use jQuery validation plugin to validate a few form fields by
I'm trying to user jQuery Validation plugin to validate a signup form, but I
I'm trying to use the Jquery validation plugin to validate my form. I have
I am trying to use jquery validate plugin on my 5 questions quiz form.
I'm trying to use the jQuery Validation plugin to make a multistep form with
I'm trying to use the jQuery validation plugin (from here --> http://bassistance.de/jquery-plugins/jquery-plugin-validation/ ) to
I'm trying to validate a form using the validate plugin for jquery. I want
I'm using the jQuery Validation plugin with Wordpress to validate my contact page. I
I am using this jQuery form validation plugin: http://docs.jquery.com/Plugins/Validation/Methods I am trying to use
I'm trying to validate a form using jquery validate plugin and I'm having a

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.