The submitHandler is not binded to the form after loading. why?

Posted by Alex on Stack Overflow See other posts from Stack Overflow or by Alex
Published on 2010-05-26T14:15:12Z Indexed on 2010/05/26 14:21 UTC
Read the original article Hit count: 266

Filed under:
|
|
|
    $(".normalform").click( function() { 

        var hrf = $(this).attr("href");
        var typ = $(this).attr("frm_type");
        var cls = $(this).attr("class");
        var nam = $(this).attr("frm_nam");
        var url = $(this).attr("url");

        //alert("href:"+hrf+", "+"type:"+typ+", "+"class:"+cls+", "+"name:"+nam+", "+"url:"+url+", "); 

        $("#contentContainer").load(url, null, function() { 

            //start validate : normalform
            jQuery("#normalform").validate({
                submitHandler: function(form) {
                    $('#submitbutton').attr('disabled', 'disabled');
                    jQuery("#normalform").ajaxSubmit({
                        target: "#result",
                        error: function () {
                            $('#submitbutton').removeAttr('disabled');
                            alert('Submission Error ! Try again.');                             
                        }, 
                        success: function (data) { 
                            $('#submitbutton').removeAttr('disabled');
                        },
                        clearForm: true
                    });
                }
            });
            //end   validate : normalform

        });

    });

© Stack Overflow or respective owner

Related posts about AJAX

Related posts about submit