@{
    CurrentUser user = new CurrentUser();
    string table = Request.QueryString["table"];
    int tableId = ViewBag.TableId;
    IEnumerable<dynamic>
    fieldData = Html.GetFieldList((string)ViewBag.Table, "Add", user, PageAdmin.Common.FromEnum.Guest);
}

<div class="main">
    <div class="container">
        <div class="form-group">
            <label class="control-label" for="content">表单html</label>
            <div class="controls">
                <textarea id="content" spellcheck="false" style="height:80%" class="form-control">
                    <!--需要先引用以下js文件，并保证每个页面只引用一次-->
                <link rel="stylesheet" href="/Incs/bootstrap/css/bootstrap.min.css">
                <script src="/Js/jquery.min.js" type="text/javascript"></script>
                <script src="/Incs/laydate/laydate.js" type="text/javascript"></script>
                <script src="/Js/basic.js" type="text/javascript"></script>
                <script src="/Js/UI/ui.js" type="text/javascript"></script>
                <script src="/Js/ValidateForm/validateForm.js" type="text/javascript"></script>
                <script src="~/Incs/UEditor/ueditor.config.js" type="text/javascript"></script>
                <script src="~/Incs/UEditor/ueditor.all.min.js" type="text/javascript"></script>
                <form method="post" class="ui-validForm" data-validate-params="beforeSubmit:'BeforeSubmit'">
                <div class="form-group">
                <label class="control-label">所属栏目*</label>
                <div class="controls form-inline">
                <select class="form-control" style="width:auto;" name="ColumnId" id="ColumnId" data-validate="dataType:'*',nullMsg:'请选择栏目!',errorMsg:'请选择栏目'" data-custom-params="valueField:'Id',textField:'Name',isTree:true,linkage:true" data-source="@@Html.GetColumnListJsonByUser(@tableId, PageAdmin.Common.FromEnum.Guest)">
                <option value="">请选择栏目...</option>
                                </select>
                <span class="help-block"></span>
                            </div>
                <script type="text/javascript">
                    $("#ColumnId").SelectBind({ dataSourceFrom: "attr" });
                    //绑定栏目数据
</script>
                        </div>
</textarea>
                <div id="htmlContent" class="hidden">
                    @{
            string beforeSubmitJs = "";
            var data = new ViewDataDictionary();
            data.Add("from", "guest");
            data.Add("currentUser", user);
            data.Add("i", 0);
            int i = 0;
            if (fieldData != null)
            {
                foreach (var row in fieldData)
                {
                    data["i"] = i;
                    beforeSubmitJs += row.BeforeSubmitJs;
                    Html.RenderPartial("~/Areas/E/Views/CustomForm/FormPartial.cshtml", (object)row, data);
                    i++;
                }
            }}
                    <div class="form-group">
                        <div class="controls form-inline">
                            <input type="text" id="verificationCode" name="verificationCode" class="form-control" maxlength="5" placeholder="验证码" data-validate="dataType:'*',nullMsg:'请填写验证码!',minLength:4,minLengthErrorMsg:'验证码最少4个字符!',checkUrl:'/E/VerificationCode/Validate',checkError:'验证码填写错误!'">
                            <img src="/E/VerificationCode/" id="verificationCodeImg" class="ui-verificationCodeImage" />
                            <span class="help-block"></span>
                        </div>
                    </div>
                    <div class="controls form-inline">
                        @@Html.AntiForgeryToken()
                        <input type="hidden" name="Guid" id="Guid" value="@("@")Html.Guid()" />
                        <button type="button" class="btn btn-sm  btn-primary ui-pagePost" data-custom-params="url:'/e/InfoData/Add?table=@table',callBack:'CallBack',successMsg:'提交成功'">提交</button>
                    </div>
                    </form>
                    <script type="text/javascript">
                        //提交前验证
                        function BeforeSubmit() {
                            //提交前的验证
                            return true;
                        }
                        //回调函数
                        function CallBack(tipsInfo) {
                            if (tipsInfo.State == 1) {
                                Alert("提交成功！", { icon: 1, closeBtn: 0 }, function () { location.href = location.href });
                            }
                            else {
                                alert(msg);
                            }
                        }
                    </script>

                </div>
                <span class="help-block"><span class="glyphicon glyphicon-info-sign"></span>此表单可用于前端投稿，复制html到视图模板页面中做成模板页即可</span>
            </div>
    </div>
</div>
</div>

<script type="text/javascript">
                            var winHeight = $(window).height();
                            $("#content").css("height", (winHeight - 150) + "px");
                            var html = $("#htmlContent").html();
                            var jsScript = $("#content").val();
                            $("#content").val(jsScript + html);
</script>
