Wednesday, May 16, 2012

iframe and validate.js

I have iframe inside my page for save data in database.I use validate.js to validate a field inside a iframe.If I validate field outside a iframe means in same page its work.If i do same thing in iframe its doesn't work.I want to know validate.js doesn't work inside a iframe?

I try:



var v = $("#form1").validate({
ignore: ':hidden',
rules: {
txtTitle: { required: true },
txtPost: { required: true },
txtSummary: { required: true }
},
messages: {
txtTitle: "Please enter a Post Title",
txtPost: "Please enter a Post description",
txtSummary: "Please enter a Post Summary"
}
});


And in button click I use like this.



 $("#btnPost").live("click", function() {
if (v.form()) {
alert("Success");
}
else {
alert("fail");
return false;
}
});


note:txtTitle,txtPost,txtSummary,btnPost all are iframe controls.Thanks.





No comments:

Post a Comment