I am trying to do manual validation so I can post my form via AJAX.
ALSO I am loading my form dynamically using $("#formHolder").load(url);
When I load the page into the DIV it always validates as true, even though my input box is empty.
i.e call if($("#MyForm").valid()) //is always true
However If I go to the page URL directly it works ok.
So how can I initialise the Form correctly after loading it via .load(url);
since it does not exist on the page when first opened
My Javascript is
$('.myLink').click(function () {
var url = '/newsletter/info/'; // this loads my HTML form from another page/view at runtime
$("#formHolder").load(url, function () {
$("#MyForm").validate(); // I thought this line would initialise it once it loads
}).dialog({
modal: true,
width:800,
height: 600
});
return false;
});