开发者

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

    $(".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

        });

    });

Additional info:

.normalform : is the link that loads the form into contentContainer

#normalform : is the formloaded, that wldnt开发者_如何学Python respond to validation function.


.normalform : is the link that loads the form into contentContainer, 
#normalform : is the formloaded, that wldnt respond to validation function.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜