i am trying to perfom form validation before submit to server. I am using jquery.validate plugin (JQuery validation plugin page) The problem i am facing is that does not matter what i type in the form fields, validation always succeded, i double checked everything against documentation and samples over the wire and cannot see why i am getting this behaviour. This form is loaded via jquery ajax:
$.ajax({
url: "mypage.php",
type: "POST",
cache: false,
success: function(cont){
$("body").append(cont);
}
});
Here i show you mypage.php code
<script src="js/jquery.validate.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#frmParticipante").validate({
rules: {
nombre: { required: true } ,
email: { required: true, email: true },
ci: { required: true}
}
});
$("#frmParticipante").submit(function(e){
e.preventDefault();
if($(this).valid()){
loadpop("ganaste.php");
}
else
loadpop("perdiste.php");
});
});
</script>
<div id="pop_terminaste" class="pop_mensaje ingresardatos animated fadeInDown">
<div id="infopop">
<div id="lady"> <img src="images/terminaste1.jpg" width="453" height="626" /> </div>
<div id="dato">
<p class="txt1">¡Terminaste la trivia!</p>
<p class="txt2">Ahora solo te falta completar tus datos para conocer el resultado.</p>
<p class="txt3">Si ha cargado anteriormente sus datos, ingresar solo su cédula.</p>
<form action="" id="frmParticipante" class="form">
<fieldset>
<label for="nombre"><img src="images/ico_nombre.png" alt="ico_nombre" /></label>
<input type="text" placeholder="Nombre y Apellido" id="nombre">
</fieldset>
<fieldset>
<label for="email"><img src="images/ico_email.png" alt="ico_email" /></label>
<input type="text" placeholder="Email" id="email">
</fieldset>
<fieldset>
<label for="ci"><img src="images/ico_ci.png" alt="ico_ci" /></label>
<input type="text" placeholder="C.I" id="ci">
</fieldset>
<p class="msg error">Favor verificar los datos ingresados.</p>
<input type="submit" value="VER RESULTADOS" />
</form>
</div>
</div>
</div>
Thanks