[jQuery] validate() and multiple forms that arrive via ajax
In a wizard I have a container page with a few divs, every div can
host a certain form, that post it's result to another div. Everything
via ajax.
On the bottom of these forms, I call something like this:
jQuery(function($){
setupAddressForm();
});
which looks like this
function setupAddressForm(){
var form = setupForm($("#formAddressStep"));
createAjaxContext(form, $("#panelpaymentoption"));
}
function setupForm(form){
$("input.ajax-invisible").hide();
$(form).validate({
submitHandler: function(form) {
$(form).ajaxSubmit();
},
currentForm : form
});
return form;
}
function createAjaxContext(form, nextStep, onSuccess){
form.ajaxForm({
target: nextStep,
success: onSuccess
});
}
But only the very first form is actually validated, Firebug tells me
that it always remains the currentForm.
How can I set subsequent forms to be the currentForm?