日期:2014-05-16  浏览次数:20848 次

ligerui 弹出层用validate验证,为什么不起作用
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="App/Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <script src="App/lib/jquery-validation/jquery.validate.min.js" type="text/javascript"></script>
    <script src="App/lib/jquery-validation/messages_cn.js" type="text/javascript"></script>
    <script src="App/lib/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
</head>
<body>
<script>
    function formChk() {

        $("#mainform").validate({
            errorPlacement: function (error, element) {
                error.insertAfter(element);
            },

            rules: { Name: { required: true }, Pwd: { required: true, digits: true} },
            messages: { Name: { required: "用户名" }, Pwd: { required: "密码", digits: "数字"} }, debug: true,
            invalidHandler: function () {
                alert('失败');
            },
            submitHandler: function () {
                alert("成功");
                            }

        });
    }
    function ShowWindow() {       
        $("#mainform").ligerForm({
            inputwidth: 150,
            fields: [{ name: 'Id', type: 'hidden' },
         { display: '姓名', name: 'Name', width: 150, type: 'text' },
         { display: '密码', name: 'Pwd', width: 150, type: 'text'}
         ]
        });
        detailWin = $.ligerDialog.open({
            target: $("#detail"),
            width: 595, height: 460, top: 80, titl