form提交验证

var saveoptions = {

                beforeSubmit: function () {

                    $("#loadingpannel").html("正在保存数据......").show();

                    return true;

                },

                dataType: "json",

                success: function (data) {

                    if (data.IsSuccess) {

                        hiAlert(data.Msg, '提示', function () { CloseModelWindow(null, true); });

                    }

                    else {

                        hiAlert("操作失败,可能的原因:\r\n" + data.Msg, '提示');

                        $("#loadingpannel").html("正在保存数据......").hide();

                    }

                }

            };

            $("#fmEdit").validate({

                rules: {},

                messages: {},

                submitHandler: function (form) {

                hiConfirm("你确认要保存吗?", "提示", function (btn) {

                            if (btn == true) {

                                $("#fmEdit").ajaxSubmit(saveoptions);

                            }

                            })

                },

                errorElement: "div",

                errorClass: "cusErrorPanel",

                errorPlacement: function (error, element) {

                    showerror(error, element);

                }

            });

猜你喜欢

转载自blog.csdn.net/qq_20426717/article/details/88757195