Hi All,
I'm developing an application with asp.net mvc and I have a form to register some customers. I'm validing this forms with JQuery Validate and works fine, but I'm try to make a customization the way like users view the messages, by the way im using errorPlacement. But when the form is validated the message that show in my "div error" is wronge message, and I need to fix it to show the correct message (the field that is in focus), take a look:
$("#fCadastro").validate({
rules: {
Nome: { required: true },
Email: { required: true, email: true },
/* others fields*/
},
messages: {
Nome: { required: 'Informe seu nome ou como gostaria de ser chamado.' },
Email: { required: 'Informe um e-Mail válido. Será através dele que entraremos em contato conforme o necessário.', email: 'Informe um endereço de e-Mail válido.' },
/* others fields*/
},
errorPlacement: function (label, element) {
/* here is showing the wronge message */
$("#erroform").fadeIn('slow');
$("#erroform").html(label);
$("#erroform label").removeClass();
},
focusInvalid: true,
errorClass: "field-validation-error"
}
Well... it's showing the last field in "#erroform" div... and not the first invalid field.
Thanks a lot