jQuery validation plugin - show only the first error at errorContainer

Posted by ookla on Stack Overflow See other posts from Stack Overflow or by ookla
Published on 2010-04-23T20:02:31Z Indexed on 2010/04/23 20:13 UTC
Read the original article Hit count: 493

Filed under:
|

Hi there, I have this:

function validateEmail(){
  // ###############################
  $("#contato_form").validate({
   errorContainer: "#wrapperError",
   errorLabelContainer: "#wrapperError span.error",
   debug:true,
      rules: {
    nome: { required:true },
    email: { required:true },
    mensagem: { required:true }
      },
      messages: {
    nome: { required:'Informe seu nome.' },
    email: { required:'Informe um endereço email válido.' },
    mensagem: { required:'Por favor, escreva sua mensagem.' }  
      },
  submitHandler: function() {
   $.ajax({
      type: "POST",
      url: "http://www.mydomain.com/sendemail.php",
      data: ({nome: $("input#nome").val(), email: $("input#email").val(), mensagem: $("textarea#mensagem").val()}),
      success: function(msg){
     $('div#enviado').html(' ').append(msg);
      }
    });
  }
   });
}   

When I submit. I got this error message:

  Informe seu nome.Informe um endereço email válido.Por favor, escreva sua mensagem.  

How can I get only the first error no that errorContainer? Once the first input is ok, then the next error and so on..

Thanks

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about validation