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

  • Home
  • SEARCH
  • 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 1958568
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T08:21:34+00:00 2026-05-17T08:21:34+00:00

Can someone point me in the right direction on this? I am using Tools

  • 0

Can someone point me in the right direction on this? I am using Tools as a validator but wanting to execute the ajax submit function that I have ONLY IF ALL validation passes. I have a working validation script here that works, and an ajax call that works; but I’m having a time trying to figure out how to get them to work together.

How can I do this?

$(document).ready(function() {
    $("#leadbanker_intake_form").validator({ 
        position: 'center right',
        offset: [0, 0],
        message: '<div><em/></div>'
    }).bind("onSuccess", function(e, els) {
        // FUNCTION HERE still works even though some forms haven't validated
    }
});
  • 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-17T08:21:35+00:00Added an answer on May 17, 2026 at 8:21 am

    As per the documentation:

    The second argument is a jQuery object containing all fields that passed the validation.

    So, in your onSuccess callback, you just need to check the length of els (the second argument) and make sure it’s equal to the total number of fields you’re validating.


    I think this should work (but I haven’t tested it):

    $(document).ready(function() {
        $("#leadbanker_intake_form").validator({ 
            position: 'center right',
            offset: [0, 0],
            message: '<div><em/></div>'
        }).bind("onSuccess", function(e, els) {
            var numSucceeded = els.length,
                numExpected = $(this).data('validator').getInputs().length;
    
            if (numSucceeded === numExpected) {
                // get your Ajax on
            }
        }
    });
    

    Edit: In your comment below, you said that if you use this code:

    $(document).ready(function() {
        $("#leadbanker_intake_form").validator({ 
            position: 'center right',
            offset: [0, 0],
            message: '<div><em/></div>'
        }).bind("onSuccess", function(e, els) {
            var numSucceeded = els.length,
                numExpected = $(this).data('validator').getInputs().length;
    
            if (numSucceeded === numExpected) {
                $("#leadbanker_intake_form").submit(function() {}
            }
        }
    });
    

    then the code just seems to be ignored. I see two problems with that.

    First, that code is syntactically incorrect – you’re missing two close parens (the code on your question was already missing one, and I forgot to add that one in). To fix the syntax, that code should be this:

    $(document).ready(function() {
        $("#leadbanker_intake_form").validator({ 
            position: 'center right',
            offset: [0, 0],
            message: '<div><em/></div>'
        }).bind("onSuccess", function(e, els) {
            var numSucceeded = els.length,
                numExpected = $(this).data('validator').getInputs().length;
    
            if (numSucceeded === numExpected) {
                $("#leadbanker_intake_form").submit(function() {}); // <-- here
            }
        }); // <-- and here
    });
    

    Note the semicolons you missed as well. I’m not sure if these syntax errors exist in the actual code you’re trying to run, or if that was a transcription error on your part, but it’s definitely a serious enough syntax error to break the whole thing.

    The other problem is that .submit(...) call binds a submit listener, if the form validated. However – and I’m not sure of this part – your form may have already submitted by the time you bind that submit handler. The solution to that problem is to bind the listener outside of the onSuccess callback. The other possibility regarding this (I really need to read over the jQuery TOOLS docs…) is that you need to manually submit the form – that is, you might be successfully binding the handler, but the form’s never actually submitting!

    I really can’t say much more without looking a the TOOLS docs, and maybe your actual code as well. If the suggestions in this edit don’t fix the problem for you, would you mind posting a jsfiddle or a jsbin that reproduces the problem?

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

Sidebar

Related Questions

No related questions found

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.