On Thu, Mar 26, 2009 at 12:45 AM, kevin <young.ke...@gmail.com> wrote:

> 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.
>
> 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.

i had a similar problem, but this seems to be working for me:

function initSigninForm() {
    var options = {
        target: '#mainContent',
        dataType: 'json',
        beforeSubmit: showRequest,
        success: showSignInResponse $('#mainContent form').ajaxForm(options);
    }
}
function showSignInResponse(xhr) {
    if (xhr.error_msg != 'No error') {
        $('#mainContent').html(xhr.content_html,
showNewContent(xhr.message, xhr.response_filepath, xhr.key));
        xhrErrorDisplay(xhr);
    } else {
        xhrResponseDisplay(xhr);
        $('#mainContent').html(xhr.content_html,
showNewContent(xhr.message, xhr.response_filepath, xhr.key));
        initSigninForm();
    }
}

Reply via email to