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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:10:29+00:00 2026-06-13T23:10:29+00:00

I have tried to validate the form using the jquery.validate plugin before being executed

  • 0

I have tried to validate the form using the jquery.validate plugin before being executed by ajax, but it failed because the ajax submit is working when using validate function.

Here is my form:

<form>
 <p><label for="cname">Name</label><em>*</em><input id="cname" name="name" size="25" class="required" minlength="2" /></p>
   <p><label for="cemail">E-Mail</label><em>*</em><input id="cemail" name="email" size="25"  class="required email" /></p>
   <p><label for="curl">URL</label><em></em><input id="curl" name="url" size="25"  class="url" value="" /></p>
   <p><label for="ccomment">Your comment</label><em>*</em><textarea id="ccomment" name="comment" cols="22"  class="required"></textarea></p>
   <p><input class="submit" type="submit" value="Submit"/></p>
 </form>

And my jquery code:

$('form').validate();
$('form').submit(function() {
  alert($(this).serialize());
  return false;
});

here is my fiddle: http://jsfiddle.net/ongisnade/tzFzR/

How to make form validate before ajax submited?

  • 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-13T23:10:30+00:00Added an answer on June 13, 2026 at 11:10 pm

    Use .valid() to check before using .serialize().

    // Initialize
    $('form').validate();
    
    // Bind
    $('form').submit(function() {
        if($('form').valid())
            alert($(this).serialize());
        else
            alert("Invalid");
        return false;
    });​
    

    Fiddle: http://jsfiddle.net/eHD4g/

    Or as Sparky672 said, use the submitHandler attribute:

    $('form').validate({
        submitHandler: function(form) {
            alert($('form').serialize());
            return false;
        }
    });
    

    Fiddle: http://jsfiddle.net/eHD4g/2/

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

Sidebar

Related Questions

I am using the jquery validation plugin to validate a form. I have the
I have a form that is using jQuery Validate plugin for client side validation,
I am using jquery validation plugin to validate my form. I have one field
I'm using jQuery's validation plugin to validate a form. I have a field which
I have a form and I am using jQuery validation plugin to validate it.
I have a jQuery Dialog form and on submit I'm trying to validate the
I have a form which I am validating through the jQuery Validate plugin. Everything
I'm using jQuery's validation plugin to validate form text fields. I'm trying to validate
I'm using an awesome plugin to validate my form on the front-end: http://docs.jquery.com/Plugins/Validation .
I'm using the jQuery validate plugin. I have this code: $(.btn-overview-basic-save).click(function(e) { if (!$('.contact-overview').valid())

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.