I have an MVC3 application.
This is the model:
public class Customer
{
[Required]
public string Email { get; set; }
[Required]
public string Answer1 { get; set; }
[Required]
[NotEqualTo("Answer1")]
public string Answer2 { get; set; }
}
I enabled the onubtrusive validation on the web.config:
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
And this on my _layout.cshtml:
<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/mvcfoolproof.unobtrusive.js")" type="text/javascript"></script>
My problem here is the MvcFoolproof is not working. The mvc data annotation validation Required
is working. What did I missed here? Thanks!