@model string
<div class="main">
    <form class=" form-group-sm form ui-validForm" method="post" data-validate-params="beforeSubmit:'BeforeSubmit'" data-source="@Model">
        <div class="form-group">
            <label class="control-label" for="name">表名</label>
            <div class="controls">
                <input type="text" name="Name" id="Name" maxlength="30" data-validate="dataType:'table',nullMsg:'请填写表名!',checkUrl:'@Url.Action("CheckExists",new{id = Request.QueryString["id"],fieldName="表名",area="Admin"})'" value="category_" class="form-control ui-edit-readonly">
                <span class="help-block">为避免和其它表冲突，分类表名建议用category_作为前缀</span>
            </div>
        </div>
        <div class="form-group top_menu_only">
            <label class="control-label" for="remark">标识</label>
            <div class="controls">
                <input type="text" name="Remark" id="Remark" maxlength="50" class="form-control">
                <span class="help-block"></span>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label" for="delete_protect">删除保护</label>
            <div class="controls checkbox">
                <label class="checkbox-inline">
                    <input type="checkbox" name="DeleteProtect" id="DeleteProtect" value="1" checked />启用
                </label>
                <span class="help-block">启用后列表页不能直接删除</span>
            </div>
        </div>

        <div class="form-group postarea">
            <div class="controls">
                @Html.AntiForgeryToken()
                <input type="hidden" name="Id" id="Id" />
                <input type="hidden" name="Uid" id="Uid" value="@ViewBag.Uid" class="form-control">
                <button type="button" class="btn btn-sm  btn-primary ui-pagePost" data-custom-params="url:'@Url.ActionUrl()',callBack:'PostRefreshBack'">提交</button>
                <button type="button" class="btn btn-sm btn-default ui-closeDialog">关闭</button>
                <span class="help-block"></span>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    var id = Request("id");
    if (IsInt(id)) {
        $(".form").FormBind({dataSourceFrom:"attr"});
    }
    function BeforeSubmit()
    {
        var $name_val = $("#name").val();
        if ($name_val=="category_")
        {
            Msg("请填写好完整的表名！")
            $("#name").focus();
            return false;
        }
        return true;
    }
</script>
