I'm trying to get setup using the DataAnnotations validator in ASP.Net MVC 2.0 Beta, but with the following model:
public class Foo {
[Required] public string Bar {get;set;}
}
And the following code in my view:
<%@ Page Title="" Language="C#" Inherits="System.Web.Mvc.ViewPage<Foo>" %>
<!-- later on -->
<% Html.EnableClientValidation(); %>
<% using (Html.BeginForm("Edit","Foo")) { %>
Everything is almost verbatim form the examples. What is emitted is:
<script type="text/javascript">
//<![CDATA[
EnableClientValidation({"Fields":[],"FormId":"form0"}, null);
//]]>
</script>
Nothing is ever emitted to tell whatever JavaScript validation library (jQuery or MS Ajax, doesn't matter) to validate the fields. The validation does happen on the server side, but never on the client, for obvious reasons.