I've setup a partial view which houses its own form tag, like so:
<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 render it on a page using @Html.Action("Create") (It's part of a table, hence the <tr> tags.
For some odd reason my clientside validation isn't working, and I first see the errors upon posting.
Is there something special about partial views and clientside validation ?
I have 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 tossing this script onto the page:
jQuery('form').submit(function ()
{
alert(jQuery(this).valid());
});
It alerts 'true', so the clientside validation script is definately there, and for some reason it's not checking the fields in question :-/
EDIT 2
I've uploaded the entire source code for the page (the HTML + JS) to pastebin: http://pastebin.com/GvqLW495