I set the partial view in which my own form tag resides, for example:
<tr> @using (Html.BeginForm("Create")) { <td> @Html.TextBoxFor(model => model.Date) @Html.ValidationMessageFor(model => model.Date) </td> <td> @Html.TextBoxFor(model => model.Amount) @Html.ValidationMessageFor(model => model.Amount) </td> <td> @Html.TextBoxFor(model => model.Tags) @Html.ValidationMessageFor(model => model.Tags) </td> <td> @Html.EnumDropDownListFor(model => model.Type) </td> <td> <input type="submit" value="Add" /> @Html.ValidationSummary(true) </td> } </tr>
I draw it on the page using @ Html.Action ("Create") (This is part of the table, hence the <tr> tags.
For some odd reason, my client check does not work, and I see errors when posting first.
Is there anything special about partial submissions and customer validation?
I included the following scripts:
<script src="/Scripts/jquery.1.5.1.min.js" type="text/javascript"></script> <script src="/Scripts/jquery.validate.min.js" type="text/javascript"></script> <script src="/Scripts/jquery.validate.unobtrusive.min.js" type="text/javascript"></script>
EDIT
I just tried throwing this script on the page:
jQuery('form').submit(function () { alert(jQuery(this).valid()); });
It prints "true", so the script client check definitely exists and for some reason does not check the corresponding fields: - /
EDIT 2
I uploaded the entire source code of the page (HTML + JS) to pastebin: http://pastebin.com/GvqLW495
asp.net-mvc-3 partial-views unobtrusive-validation
Steffen
source share