Multiple forms and validate
Hi,
I need to validate a multiple fields. My problem is that the error message goes to the first element. If i fill the first name and leave the second empty, the error message appear at the first element.
I´ve got a form like this:
<form action="#" method="post" name="formPassoDois" id="formPassoDois">
<input type=text name="nome[]" class="txtNome" id="nome" size="50" maxlength="80" />
<input type=text name="cpf[]" id="cpf" size="15" maxlength="11" />
</form>
My validate is like this:
$("#formPassoDois").validate({
rules: {
"nome[]": required,
"cpf[]": required
},
messages: {
"nome[]": {
required: "Campo nome vazio!"
},
"cpf[]": {
required: "Campo cpf vazio!"
},
});
Thanks,
Vitor