<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/ViewMasterPageSub.Master"
	Inherits="System.Web.Mvc.ViewPage<IEnumerable<MvcEnterprise.Models.CustomForm.RowModel>>" %>

<asp:Content ID="Content2" ContentPlaceHolderID="HeadContent" runat="server">
	<style type="text/css">
		#form1 div
		{
			height: 21px;
			line-height: 21px;
		}
		span.field
		{
			display: inline-block;
			width: 80px;
			text-align: right;
		}
	</style>
	<link href="../../Content/Skin/Validation.css" rel="stylesheet" type="text/css" />
	<script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
	<script src="../../Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script>
	<script src="../../Scripts/MicrosoftMvcValidation.js" type="text/javascript"></script>
	<script src="../../Scripts/Admin.js" type="text/javascript"></script>
	<%Html.EnableClientValidation(); %>
	<script src="../../Scripts/CheckForm.js" type="text/javascript"></script>
	<link href="../../Scripts/calendar.css" rel="stylesheet" type="text/css" />
	<script src="../../Scripts/calendar.packed.js" type="text/javascript"></script>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="LeftContent" runat="server">
	<div class="Item">
		<div class="LeftNavTitle"><%= Language.Context.User.LabelNavTitle %></div>
		<div>
			<%Html.RenderPartial("partial_LeftNav_User");%></div>
	</div>
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="RightContent" runat="server">
	<div class="Item">
		<div class="Location">
			<%= Html.ActionLink(Language.Context.Global.HomePage, "Index")%>
			<%= Language.Context.Global.LabelSubmitForm %>
		</div>
		<div class="WebContent" style="margin-left:35%">
			<script type="text/javascript">
				$(document).ready(function () {
					$(".editor-label").width("80px");
					$("#validateImg").after(" <span id='vCodeErr' style='color:red'></span>");
					var username = $("#frmuserreg #MemName");
					username.blur(function () {
						if ($.trim(username.val()).length >= 3) {
							$("#err_msg").load('<% =Url.Action("UserRegCheckExist") %>', { "username": username.val() });
						}
					}).focus(function () {
						$("#err_msg").empty();
					});
					$("#frmuserreg #txtValidateCode").keydown(function () {
						$("#vCodeErr").text("");
					});
					$("#frmuserreg").submit(function () {
						if ($.trim($("#frmuserreg #txtValidateCode").val()).length < 5) {
							$("#vCodeErr").text("<%= Language.Context.Global.JsAlertValidationErr %>");
							return false;
						}
					});
				});
			</script>
			<form method="post" id="form1" name="form1" action="?tablename=<%= Request.QueryString["tablename"] %>" onsubmit="return CheckForm(this);">
			<%= Html.AntiForgeryToken()%>
			<%foreach (var item in Model)
	 {%>
			<div>
				<span class="field"><%= item.FieldName %>：</span>
	 <%
		 switch (item.InputType)
		 {
			 case 1:
				 %>
				 <input type="text" id="<%= item.FieldName %>" name="<%= item.FieldName %>" cnname="<%= item.FieldName %>" checktype="<%= item.Rule %>" <%= item.Rule=="num" ? "checkrule='1,9'" : "" %> <%= item.Rule=="date" ? "onfocus='showCalendar(&#39;"+item.FieldName+"&#39;, this)'":"" %>/> <%= item.Content%>
				 <%
				 break;
			 case 2:
				 %>
				 <textarea name="<%= item.FieldName %>" cnname="<%= item.FieldName %>" checktype="<%= item.Rule %>" <%= item.Rule=="num" ? "checkrule='1,9'" : "" %>></textarea> <%= item.Content%>
				 <%
				 break;
			 case 3:
				 %>
				 <select name="<%= item.FieldName %>" cnname="<%= item.FieldName %>" checktype="txt ">
					<%
					var arrayOption = item.Content.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
					foreach (var option in arrayOption)
					{
					%>
					<option value="<%= option %>"><%= option %></option>
					<%
					}
					 %>
				 </select>
				 <%
				 break;
			 case 4:
				var arraycb = item.Content.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
				foreach (var cb in arraycb)
				 {
				%>
				 <label><input type="checkbox" name="<%= item.FieldName %>" cnname="<%= item.FieldName %>" checktype="txt " value="<%= cb  %>" /><%= cb %> </label>
				<%
				 }
				 break;
			 default:
				 break;
		 }%>
			</div>
		 <%
			 } %>
			<div>
				<%Html.RenderPartial("ValidateCode"); %>
			</div>
			<div>
				<span class="field"></span>
				<input type="submit" value=" <%= Language.Context.Global.LabelSubmitForm %> " />
			</div>
			</form>
		</div>
	</div>
</asp:Content>