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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:51:43+00:00 2026-05-10T21:51:43+00:00

I am trying to make the Validation plugin work. It works fine for individual

  • 0

I am trying to make the Validation plugin work. It works fine for individual fields, but when I try to include the demo code for the error container that contains all of the errors, I have an issue. The problem is that it shows the container with all errors when I am in all fields, but I would like to display the error container only when the user presses the submit button (but still show inline errors beside the control when losing focus).

The problem is the message in the container. When I took off the code as mentioned in the answer below for the container, the container output just displays the number of errors in plain text.

What is the trick to get a list of detailed error messages? What I would like is to display ‘ERROR’ next to the control in error when the user presses the tab button, and to have a summary of everything at the end when he presses submit. Is that possible?

Code with all input from here:

    $().ready(function() {         var container = $('div.containererreurtotal');          // validate signup form on keyup and submit         $('#frmEnregistrer').bind('invalid-form.validate', function(e, validator) {           var err = validator.numberOfInvalids();           if (err) {             container.html('THERE ARE '+ err + ' ERRORS IN THE FORM')             container.show();           } else {             container.hide();           }         }).validate({                     rules: {                             nickname_in: {                                     required: true,                                     minLength: 4                             },                             prenom_in: {                                     required: true,                                     minLength: 4                             },                             nom_in: {                                     required: true,                                     minLength: 4                             },                             password_in: {                                     required: true,                                     minLength: 4                             },                             courriel_in: {                                     required: true,                                     email: true                             },                             userdigit: {                                     required: true                             }                     },                     messages: {                             nickname_in: 'ERROR',                             prenom_in: 'ERROR',                             nom_in: 'ERROR',                             password_in: 'ERROR',                             courriel_in: 'ERROR',                             userdigit: 'ERROR'                     }                      ,errorPlacement: function(error, element){                             container.append(error.clone());                             error.insertAfter(element);                     }              });     }); 
  • 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. 2026-05-10T21:51:43+00:00Added an answer on May 10, 2026 at 9:51 pm

    You will find the documentation for the meta option in http://docs.jquery.com/Plugins/Validation/validate#toptions

    If you want to display the errors beside the inputs AND in a separate error container you will need to override the errorPlacement callback.

    From your example:

    ...                     courriel_in: 'ERROR',                     userdigit: 'ERROR'             }             ,errorContainer: container              ,errorPlacement: function(error, element){                 var errorClone = error.clone();                 container.append(errorClone);                 error.insertAfter(element)                           }              // We don't need this options             //,errorLabelContainer: $('ol', container)             //,wrapper: 'li'             //,meta: 'validate'     });  ... 

    The error parameter is a jQuery object containing a <label> tag. The element parameter is the input that has failed validation.

    Update to comments

    With the above code the error container will not clear errors because it contains a cloned copy. It’s easy to solve this if jQuery gives a ‘hide’ event, but it doesn’t exist. Let’s add a hide event!

    1. First we need the AOP plugin
    2. We add an advice for the hide method:

                  jQuery.aop.before({target: jQuery.fn, method: 'hide'},                 function(){                     this.trigger('hide');                 }); 
    3. We bind the hide event to hide the cloned error:

              ...         ,errorPlacement: function(error, element){             var errorClone = error.clone();             container.append(errorClone);             error.insertAfter(element).bind('hide', function(){                 errorClone.hide();             });         }         ... 

    Give it a try

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

Sidebar

Ask A Question

Stats

  • Questions 214k
  • Answers 214k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You have to do the equality check explicitly, by using… May 12, 2026 at 10:41 pm
  • Editorial Team
    Editorial Team added an answer For future readers of this post: the ability to receive… May 12, 2026 at 10:41 pm
  • Editorial Team
    Editorial Team added an answer AFAIK Google doesn't give out the IP addresses in its… May 12, 2026 at 10:41 pm

Related Questions

How can I execute some javascript when a Required Field Validator attached to a
I am trying to wrap my head around doing validation in a MVC scenario.
I saw a similar post that was trying to do this same thing with
I need some help - I am trying to use a custom validation attribute

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.