I have an MVC app with a Partial View (below). When I add Html.EnableClientValidation(), my fields disappear upon exiting them. I don't expect anyone to figure it out from the code, but if anyone has seen such behavior and can point me in the right direction, I'd appreciate it. In the mean time, I'll start rebuilding piece by piece and see what I can see and will report back.
Thanks!
<%= Html.ValidationSummary() %>
<% Html.EnableClientValidation(); // IMPORTANT: this line MUST be *before* Html.BeginForm() block %>
<% using (Ajax.BeginForm("Save", "Items", new AjaxOptions { HttpMethod = "post", InsertionMode = InsertionMode.Replace, UpdateTargetId = "ItemPane"})){%>
<%=Html.AntiForgeryToken()%>
<%=Html.Hidden("Item.Id", (ViewData.Model.Item != null) ? ViewData.Model.Item.Id : Guid.Empty)%>
<!--more hidden items elided-->
<table> <!--yes, I know it should be divs-->
<tr>
<td rowspan="2" width="400px">
<div class="formarea">
<fieldset>
<ol>
<li>
<label id="Item_Label"><%= (ViewData.Model != null && ViewData.Model.Item != null) ? String.Format("Item Number {0} v. {1}", ViewData.Model.Item.ItemNumber, ViewData.Model.Item.Iteration) : "New Item" %></label>
</li>
<li>
<label for="Item_Prompt" class="formLabel">Directions:</label>
<%=Html.TextAreaFor(t => t.Item.Directions, 3, 50, new { @class = "text2000", @maxlength = "2000" })%>
<%= Html.ValidationMessageFor(t => t.Item.Directions, "*")%>
</li>
<li>
<label for="Item_Prompt" class="formLabel">Prompt:</label>
<%= Html.TextBoxFor(model => model.Item.Prompt, new { @class = "text200", @maxlength = "200" })%>
<%= Html.ValidationMessageFor(model => model.Item.Prompt, "*")%>
</li>
I have the following script references:
<%= Html.Script("~/Scripts/MicrosoftAjax.debug.js") %>
<%= Html.Script("~/Scripts/MicrosoftMvcAjax.debug.js") %>
<%= Html.Script("~/Scripts/jquery-1.4.2.min.js") %>
<%= Html.Script("~/Scripts/jquery-ui-1.8.2.custom.min.js") %>
<%= Html.Script("~/Scripts/jquery.form.js") %>
<%= Html.Script("~/Scripts/MicrosoftMvcValidation.js") %>