I have two different views belonging to two different controllers. A view the first controller works fine with unobtrusive validation. The 2nd view does not. It seems like validation plugin is not running because $.validator.unobtrusive
is undefined
.
In the shared _layout file I have the following script tags:
<script src="@Url.Content("~/Scripts/jquery-1.7.2.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-ui-1.8.19.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/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
so why is the 2nd view not working with unobtrusive validation?
Update
In both cases I am loading the forms via Ajax calls. I have verified the the main page with the broken validation can support unobtrusive validation for non-ajax loaded forms.
Update2
I finally got it working, but it's not a permanent fix yet. The source of the problem is an editable Telerik MVC Grid on the same page. It's somehow deleting/preventing the $.validator.unobtrusive
from being used in my ajax loads.