I'm using the jQuery Validate plugin to validate a form. When I declare the rules in the input declaration the form turns red when it does not fit the same, and blue when they fit. Here is an example of an input statement with inline rules:
<div class="input-prepend">
<span class="add-on"><i class="icon-user"></i></span>
<input class="span4" id="nome" size="16" name="nome" type="text" placeholder="Nome" required minlength="2">
</div>
However, when I validate through a function, the form does not receive stylization. I think it's something Bootstrap or something similar. Here is an example of validation through the function:
<script type="text/javascript">
$(document).ready( function() {
$("#idCadastro").validate({
rules: {
nome: {
required: true, minlength: 2
}
messages: {
nome: {
required: "Digite o seu nome", minLength: "O seu nome deve conter, no mínimo, 2 caracteres"
}
});
});
</script>
What I would like to know is if I have to do the stylization myself using function validation or some result that it provides.