[jQuery] [form] Handling "re-ajax'ing" a form after a submission attempt
Hello,
I am having a problem re-binding a form with ajaxForm() and Zend
Framework.
I got the ajax form submit working, but on form validation failure I
am passing back the form html within a json object and I re-stuff the
div container with the form html in order to render out form errors.
This works fine.
My problem is re-intializing the form that has been passed back with
the ajaxForm() function. When I try re-submit the form, nothing
happens.
When the form is passed back via JSON object, I still use the same
element ID I used for the initial form prior to submitting. I tried
changing the element ID in the form to be passed back but still does
not work..
I am not sure what I am doing wrong...
Does anyone have any suggestions?
Thanks
Below is my showResponse() function
function showResponse(responseText, statusText) {
if ("1" == responseText.statusCode) {
// Form Error
alert('Story Errors!');
$('#header-submit-container').html(responseText.html);
$('#myForm1').ajaxForm(responseText.formOptions);
} else if ("2" == responseText.statusCode) {
// Form Success
alert('Story Submitted!');
}
}