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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:19:40+00:00 2026-05-25T06:19:40+00:00

I am hooking into Html Form submissions where the submit buttons have a specific

  • 0

I am hooking into Html Form submissions where the submit buttons have a specific class, using $(“.formSubmitTypes”).live(‘click’, function() { do stuff here });

however – I need to wait for various client-side (jQuery) validation routines to run as I need to wait for a particular validation summary to become visible before processing any actions – at the moment, the first click will detect that there are no validation errors because immediately after clicking, the various validation divs and spans are not shown, obviously, because the pages’ initial state is clear of any user input and therefore there are no errors.

The 2nd time and all subsequent times clicking the submit button, the divs and spans ARE then visible and the logging process works – but this is almost useless as I need to make it handle the initial click and almost “wait” for the other stuff to happen before I continue.

Is there a better way of doing this? Can I bind to something other than “click”, I almost need an event like “validationFailed” to bind to and then execute the functions I need to.

The idea is to capture validation messages that have been injected into the DOM and displayed and log them, just to give the process some context.

Code I currently have (shortened and abbreviated somewhat):

$(".formSubmitButton").live('click', function () {
    if ($("#validationMessageContainer").is(":visible")) {
        someProcess.Log('Validation Failed', collectionOfValidationFailedMessages);
    }
});

I need to somehow extend this to wait for the #validationMessageContainer to arrive in the DOM and THEN bundle up all of it’s child HTML and log the validation errors therein.

Many thanks
-SB

  • 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-25T06:19:41+00:00Added an answer on May 25, 2026 at 6:19 am

    Keep in mind that as long as your validation isn’t asynch, to wait for its results before logging/submitting the form is a simple task:

    $('#yourformid').submit(function() {
        var validation = doFormValidation(); //Assumes it constructs and returns an object that contains: .isValid (bool) and .errors (array of string error messages)
        if(!validation.isValid)
        {
            displayAndLogValidationErrors(validation.errors);  //In here you can have your logic to test to see if the particular error messages have already been logged.  Perhaps construct an object that will contain the logged messages in an array, and just test to see if that array already contains the error message before logging new ones.
        }
        return validation.isValid; //When valid is false, this will stop the form from submitting.
    });
    

    I think you’ll have better luck binding to the submit event on your form than the click of your button. It’s easier to halt submission that way and will handle scenarios where the form gets submitted by, say, pressing Enter.

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

Sidebar

Related Questions

I have a WPF app that is using the MVVM pattern. Hooking up buttons
I'm looking for a relatively simple method of hooking into all click events in
I've been working through the Stanford iPhone Coding course and currently hooking into the
I have a RichTextBox in .NET WinForms. I have been hooking up hot keys
I have a single linq to sql class. I would like to detect if
I have a control in my parent mdi form which I wish to be
I have a simple form, with two DateTimePicker-controls: One for date, and one for
I have been looking into the possibility of creating a soft copy(image/EMF file) of
I'm trying to load a few modules via hooking into the AppDomain.AssemblyResolve and AppDomain.ReflectionOnlyAssemblyResolve
If I have a databound form, how do I know if a user has

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.