Jquery Validation Central Message Many Errors
        Posted  
        
            by Iamjon
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Iamjon
        
        
        
        Published on 2009-11-16T08:29:32Z
        Indexed on 
            2010/05/30
            18:02 UTC
        
        
        Read the original article
        Hit count: 239
        
jQuery
|validation
Hi everyone, I have a form that is being valdated with the Jquery Validation Plugin. I have managed to get a centeral message "Please Recheck the form", and to have the input focus on the first error. To get this, I had to override the default message of each of the errors. I was wondering if anyone could help me figure out how I can have it display the error message associated with the first error input instead of a general error message. Here is the code:
$("#Help-A-Noobie-Form" ).validate({
 invalidHandler: function(form, validator) {      
     $(this).find(":input.error:first").focus();
     var message = 'Please Recheck The Form' ;
    $("#Help-A-Noobie-Form #Message p").addClass('red').html(message);        
   },
showErrors: function(errorMap, errorList) {
this.defaultShowErrors(); },
rules: {
          required:true,
          email: {email:true},
          phone: {digits:true}
           },  
messages: { email: "", phone: "", lastname: "", firstname: "", required:"" } })
© Stack Overflow or respective owner