表单验证不工作jquery

时间:2014-06-17 23:52:39

标签: jquery validation

点击我正在执行的按钮验证表单。我做错了什么?

 $(".ddlCart li").click(function (e) {

        var agentId = $("#AgentId").val();
         var postData = {
            AgentId: agentId            
        };

       var open = function (event, ui) {
            var agentId = $("#AgentId").val();
            var url = EnvironmentURL + "/Stats/SearchContacts";

            $("#lnkCreateNewcart").on("click", function () {

            var url = EnvironmentURL + "/MLSReports/Stats/Cart";
            //Send the data using post and put the results in a div                   
            $.post(url, {
                      ActionTypeValue: "CreateNewContact"
                        },
                    function (data) {
                     // Replace current data with data from the ajax call to the div.         
                                    $("#dvModalDialog").empty().append(data);
                                });
                        }); 

            $(document).on("click",'#btnContinue', function () {
                            $("#formCreateContact").submit();
                        });      


             };

            $("#formCreateContact","#dvModalDialog").validate({  
                           rules: {
                               ContactFirstName: {  
                                   required: true
                               }
                           },
                           messages: { 
                               msg: {
                                   required: "please input msg"
                               }
                           },  
                           errorPlacement: function (error, element) {
                               error.insertAfter(element);
                           }
                       });

        var rd = Mod.ReportsDialog({
            title: 'Add To Cart',
            open: open
        });
        rd.url = EnvironmentURL + "/Stats/Cart";
        rd.targetElement = '#dvModalDialog'
        rd.formName = '#frmCart'
        rd.postData = postData
        rd.open();

        });

0 个答案:

没有答案