0

我搜索了论坛,并找到了一些使用对话框的验证示例。我使用了其中之一的代码,但我无法让它工作。我已经在下面发布了 Jquery 代码。我的对话框是否必须已经存在于 html 中,如果是,我该如何定义它?这是我正在使用的验证功能:

<script>
$(document).ready(function(){

    $('form[name="_Deal"]').validate({
         submitHandler: function (form) {
                    //form.submit();
                 },
        rules: {
                TransCloseDate: { required: true, date: true }
        },   
        messages: {
            TransCloseDate: "Please enter a valid date."
        },
                errorPlacement: function (error, element) {
                error.appendTo($("#dialog"));
            },

    invalidHandler: function() {
    $("#dialog").dialog('open');
},

                errorContainer: "#dialog",
                errorLabelContainer: "#dialog ul",
                wrapper: "li", debug: true,
                onfocusout: false,
                onclick: false
    });
        $("#dialog").dialog({
            autoOpen: false,
            modal: true,
            close: function (event, ui) {
                $("#dialog").html("");
            },
           title: 'Please fix the following:',
            resizable: false,
            width: 300
        });
  });
4

0 回答 0