jquery easyui form表单的验证


@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
    @*添加Jquery EasyUI的样式*@
    <link href="@Url.Content("~/Content/JqueryEasyUI/themes/default/easyui.css")" rel="stylesheet" />
    <link href="@Url.Content("~/Content/JqueryEasyUI/themes/icon.css")" rel="stylesheet" />
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" />

    @*添加Jquery,EasyUI和easyUI的语言包的JS文件*@
    <script src="@Url.Content("~/Content/JqueryEasyUI/jquery-1.8.0.min.js")"></script>
    <script src="@Url.Content("~/Content/JqueryEasyUI/jquery.easyui.min.js")"></script>
    <script src="@Url.Content("~/Content/JqueryEasyUI/locale/easyui-lang-zh_CN.js")"></script>

    @*日期格式的引用*@
    <script src="@Url.Content("~/Content/datapattern.js")"></script>
    <script type="text/javascript"> 
        
        $(function () {
            //初始化绑定各种事件
            BindUpdatePermissionInfo();
            BindBtnDialog();
         }
        )
        function BindBtnDialog() {
            $('#btnDialog').click(function () {
                $("#DivUpdatePermission").dialog('open').dialog('setTitle', '修改权限信息');
            }
            );

        }
        function BindUpdatePermissionInfo() {
            $("#btnUpdate").click(function () {
                //首先也是对用户进行检测,以下是对form表单的验证
                var validate = $("#ffUpdate").form("validate");
                if (validate == false) {
                    return false;
                }
                //构造参数发送给后台
                var posData = $("#ffUpdate").serializeArray();
                $.get("/Permission/UpdatePermissionInfo", posData, function (date) {
                    if (date == "OK") {
                        //修改成功,关闭弹出层,刷新DataGird
                        debugger
                        $.messager.alert("友情提示", "修改成功");
                        $("#DivUpdatePermission").dialog('close');//关闭弹窗
                      //  $("#test").datagrid("reload");
                    }
                    else {
                        $.messager.alert("友情提示", "修改失败,请您检查");
                    }
                })
            });
        }


    </script>
</head>
<body>

    <div>
        <a href="#" id="btnDialog" class="easyui-linkbutton" data-options="iconCls:'icon-save'">保存申请</a>
    </div>

    <!------------------------弹出修改权限信息的弹出层---------------------------------->
    <div id="DivUpdatePermission" class="easyui-dialog" style="width: 580px; height: 382px; padding: 10px 20px"
         closed="true" resizable="true" modal="true" buttons="#dlg-buttons">
        <form id="ffUpdate" method="post" novalidate="novalidate">
            <fieldset>
                <legend>权限信息的修改</legend>
                <table id="tblUpdate">
                    <tr>
                        <td>
                            <input type="hidden" id="ID" name="ID" />
                            <label for="PerMission1">权限名称:</label>
                        </td>
                        <td>
                            <input class="easyui-validatebox" type="text" id="PerMission1" name="PerMission" data-options="required:true,validType:'length[1,32]'" />
                        </td>
                        <td>
                            <label for="RequestHttpType1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;请求类型:</label>
                        </td>
                        <td>
                            <select id="RequestHttpType1" class="easyui-combobox" style="width: 154px;" name="RequestHttpType" data-options="required:true">
                                <option value="0" selected="selected">HttpGet</option>
                                <option value="1">HttpPost</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label for="ActionType">权限类型:</label>
                        </td>
                        <td>
                            <select id="ActionType1" class="easyui-combobox" style="width: 154px;" name="ActionType" data-options="required:true">
                                <option value="0">普通权限</option>
                                <option value="1" selected="selected">特殊权限</option>
                            </select>
                        </td>
                        <td>
                            <label for="SortCode1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;排序码:</label>
                        </td>
                        <td>
                            <input class="easyui-validatebox" type="text" id="SortCode1" name="SortCode" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label for="RequestURL1">请求地址:</label>
                        </td>
                        <td colspan="3">
                            <input style="width:400px;" class="easyui-validatebox" type="text" id="RequestURL1" name="RequestURL" data-options="required:true" />
                        </td>

                    </tr>
                    <tr>
                        <td>
                            <label for="AllowDelete1">允许删除:</label>
                        </td>
                        <td>
                            <select class="easyui-combobox" id="AllowDelete1" style="width: 154px;" name="AllowEdit" data-options="required:true">
                                <option value="1">允许</option>
                                <option value="0">不允许</option>
                            </select>
                        </td>
                        <td>
                            <label for="AllowEdit1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;允许编辑:</label>
                        </td>
                        <td>
                            <select class="easyui-combobox" id="AllowEdit1" style="width: 154px;" name="AllowEdit" data-options="required:true">
                                <option value="1">允许</option>
                                <option value="0">不允许</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label for="IsVisible1">是否显示:</label>
                        </td>
                        <td>
                            <select id="IsVisible1" class="easyui-combobox" style="width: 154px;" name="IsVisible" data-options="required:true">
                                <option value="1">显示</option>
                                <option value="0">不显示</option>
                            </select>
                        </td>
                        <td>
                            <label for="Enabled1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;是否有效:</label>
                        </td>
                        <td>
                            <select class="easyui-combobox" id="Enabled1" style="width: 154px;" name="Enabled" data-options="required:true">
                                <option value="1">有效角色</option>
                                <option value="0">无效角色</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label for="Description1">备注信息:</label>
                        </td>
                        <td colspan="3">
                            <textarea style="height: 50px; width: 406px;" id="Description1" name="Description"></textarea>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4" style="text-align: center; padding-top: 10px">
                            <a href="javascript:void(0)" class="easyui-linkbutton" id="btnUpdate" iconcls="icon-ok">确定</a>
                            <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript:$('#DivUpdatePermission').dialog('close')">关闭</a>
                        </td>
                    </tr>
                </table>
            </fieldset>

        </form>
    </div>

</body>
</html>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值