I have a form with 2 invisible DIV which got visible once a button is clicked, poping-up fancybox window. I have the jQuery validatorengine plugin, which does all the validation stuff. The problem is that the validation engine works fine for normal fields but not for the hidden fields which are inside the fancybox window, once they are visible. I suspect this is because fancybox at runtime puts them outside the scop of <form/>
which is causing the validation engine to fail, because it can not work on elements outside a form tag.
$(document).ready(function() {
$("#category").validationEngine('validate');
$('#wrapper #addCat').live('click', function() {
$('<a href="#addCategoryDiv"/>').fancybox({
'autoDimensions' : false,
'hideOnContentClick' : false,
'height' : 450,
'width' : 500,
'scrolling' : 'no'
}).click();
});
$('#wrapper #editCat').live('click', function() {
$('<a href="#editCategory"/>').fancybox({
'autoDimensions' : false,
'hideOnContentClick' : false,
'height' : 450,
'width' : 500,
'scrolling' : 'no'
}).click();
});
});
Can someone please help me how to fix this? I can see in Firebug that fancybox has made <div style="display:none">
part of code outside the <form></form>
tag.