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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:04:36+00:00 2026-05-14T23:04:36+00:00

How can I display both individual error messages and summary for the jQuery plugin?

  • 0

How can I display both individual error messages and summary for the jQuery plugin?

I actually found a similar question , but it just references some hooks I can use, but I’m not sure where to start.

I got the displaying individual error messages part, but I need to display the summary in an alert box on submit, and plugin can be found here.

Just found out how, thanks for David’s code, and on my follow-up question – The alert box would be “First Name: Please enter a valid First Name”.

Code below:

$(document).ready(function() {
    var submitted = false;
    ('.selector').validate({
        showErrors: function(errorMap, errorList) {
            if (submitted) {
                var summary = "You have the following errors: \n";
                $.each(errorMap, function(key, value) {
               summary += key + ': ' + value + "\n";
                });
                alert(summary);
                submitted = false;
            }
            this.defaultShowErrors();
        },
        invalidHandler: function(form, validator) {
            submitted = true;
        }
    });
});
  • 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-14T23:04:36+00:00Added an answer on May 14, 2026 at 11:04 pm

    As the linked question says, the showErrors callback is called whenever errors are shown. You can use this to create your summary and alert it. You can then call this.defaultShowErrors() to display the normal individual error messages.

    By default showErrors is called for a lot of events (submit, keyup, blur, etc). You could either disable those, or use the invalidHandler method which is only called when an invalid form is submitted.

    Example:

    $(document).ready(function() {
        var submitted = false;
        ('.selector').validate({
            showErrors: function(errorMap, errorList) {
                if (submitted) {
                    var summary = "You have the following errors: \n";
                    $.each(errorList, function() { summary += " * " + this.message + "\n"; });
                    alert(summary);
                    submitted = false;
                }
                this.defaultShowErrors();
            },          
            invalidHandler: function(form, validator) {
                submitted = true;
            }
        });
    });
    

    See here for a complete list of options that can be passed to the validate method.

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

Sidebar

Related Questions

Similar to the XP login screen, in Flex 3, how can I display a
I display receipt in both HTML and printer-friendly version. HTML version does jQuery tabs,
Can anyone tell me how I can display a status message like 12 seconds
With LINQ to SQL in a ASP.NET MVC website I can display objects (records)
I have a small app which references the Microsoft.SqlServer.Smo assembly (so I can display
I'm using System.Drawing.Color, is there anything in Visual Studio that can display the color
How can I display a sort arrow in the header of the sorted column
How can I display something over all other application. I want to to display
I can't display the first entry from my query that returns multiple answers. For
If you have a statically allocated array, the Visual Studio debugger can easily display

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.