Jump to content
Fórum Script Brasil
  • 0

jquery validate não funciona


marconde
 Share

Question

já validei outros formularios com jquery validate mas não entendo porque este form não esta sendo validado. A unica diferença dele para os outros formularios que eu fiz e que os inputs estão dentro de fildsets e divs por questoes de formatação do css. As mascaras funcionam normalmente. Agradeço a ajuda!
 
<script type="text/javascript">
$(document).ready(function(){
$("#formCondominio").validate({
rules:{
nome:{required: true},
cpf:{required: true},
email:{required: true, email: true},
usuario{required: true},
senha:{required: true},
confsenha:{required: true, equalto: "xsenha"},
condominio:{required: true},
apto:{required: true},
qtdCarro:{required: "#carro: checked"},
qtdMoto:{required: "#moto: checked"},
datan:{required: true},
sexo:{required: true}
},
messages:{
nome:{required: "Campo obrigatorio"},
cpf:{required: "Campo obrigatorio"},
email:{required: "Campo obrigatorio", email: "Insira um email valido"},
usuario:{required: "Campo obrigatorio"},
senha:{required: "Campo obrigatorio"},
confsenha:{required: "Campo obrigatorio", equalTo: "As senhas não conferem"},
condominio:{required: "Campo obrigatorio"},
apto:{required: "Campo obrigatorio"},
qtdCarro:{required: "Informe a quantidade de veiculo"},
qtdMoto:{required: "Informe a quantidade do veiculo"},
datan:{required: "Campo obrigatorio"},
sexo:{required: "Campo obrigatorio"},
}
});
});
</script>
 
<script>
$(function(){
$("#xcpf").mask("999.999.999-99");
$("#xtel").mask("(99)-9999-9999");
});
</script>
</head>

 

Formulario:

 

<form id="formCondominio" method="POST" action="clientes.php" >
 
<fieldset id="grupo1">
<div class= "campo">
<label for="xnome">Nome</label> 
<input type="text" name="nome" id="xnome" placeholder="nome completo" size= "43" maxlength="120" autofocus>
</div>
</fieldset>
 
<fieldset id="grupo2">
<div class= "campo">
<label for="xcpf">CPF</label>
<input type= "text" name="cpf" id="xcpf" size="10" maxlength="14"> 
</div>
</fieldset><br>
 
<fieldset id="grupo1">
<div class= "campo">
<label for="xemail">Email</label>
<input type= "text" name="email" id="xemail" placeholder="[email protected]" size= "30" maxlength="30"> 
</div>
</fieldset>
 
<fieldset id="grupo2">
<div class= "campo">
<label for="xusuario">Usuario</label> 
<input type= "text" name="usuario" id="xusuario" size="19" maxlength="16">
</div>
</fieldset><br>
 
<fieldset id="grupo1">
<div class= "campo">
<label for="xsenha">Senha</label> 
<input type= "password" name="senha" id="xsenha" placeholder="8 digitos" maxlength="8" >
</div>
</fieldset>
 
<fieldset id="grupo2">
<div class= "campo">
<label for="xconfsenha">Confirmar senha</label> 
<input type= "password" name="confsenha" id="xconfsenha" placeholder="8 digitos" maxlength="8">
</div>
</fieldset><br>
 
<fieldset id="grupo1">
<div class= "condominio">
<label>Condominio</label><select name="condominio">
<option value="" selected disabled style="display: none;">informe</option>
<option value="santa clara"><label>Santa clara</label></option>
<option value="imperial"><label>Imperial</label></option>
</select>
</div>
</fieldset>
 
<fieldset id="grupo2"> 
<div class="condominio">
<label for="xapto">N°apto</label> <input type="text" name="apto" id="xapto" class="espaco" size= "1" maxlength="4"> 
<input type="checkbox" name="carro" id="xjs" value="carro" > <label for="xcarro">Carro</label>
<input type="number" min="1" max="5" name="qtdCarro" id="xqtd" class="meuInput espaco" > 
<input type="checkbox" name="moto" id="moto" value="moto"> <label for="xmoto">Moto</label> 
<input type="number" min="1" max="5" name="qtdMoto" id="xqtd" class="meuInput">
</div>
</fieldset><br>
 
<input type= "text" name= "telefone2" placeholder="contato opcional" size="21" maxlength="9" >
</div>
</fieldset><br>
 
<fieldset id="grupo1">
<div class= "campo">
<label>Data de nascimento</label> 
<input type= "date" name= "datan">
</div>
</fieldset>
 
<fieldset id="grupo2">
<div class= "labelSexo">
<label>Sexo</label>
<label for="xmasc"> <input type="radio" name="sexo" id="xmasc" value="M" >Masculino &nbsp&nbsp;</label>
<label for="xfem"> <input type="radio" name="sexo" id="xfem" value="F">Feminino</label>
</div> 
</fieldset><br>
 
<fieldset id="butoes">
<input type="submit" name="cadastro" value="Enviar" class="btf">
<input type="reset" class="btc" value="Cancelar">
</fieldset><br>
 
<p><sup>*</sup>&nbsp;Ao informar que possui veiculo, informe a quantidade na caixa ao lado.</p>
 
 
</form>
 
Tirei os select dos telefones para o codigo não ficar maior.
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Forum Statistics

    • Total Topics
      149.6k
    • Total Posts
      646.2k
×
×
  • Create New...