Reputation: 1000
I am learning asp.net mvc and jquery. I have used jqueryui in my layout page, following is the code (using jquery 1.9.1 and jqueryui 1.10.3):
<head>
<title>@ViewBag.Title</title>
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/smoothness/jquery-ui-1.10.3.custom.min.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery-1.9.1.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.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-ui-1.10.3.custom.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/modernizr-2.5.3.min.js")" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
// JOIN - REGISTER BUTTONS
$("#btnSignIn").button({
icons: {
primary: "ui-icon-person"
},
text: true
});
$("#btnJoin").button({
icons: {
primary: "ui-icon-gear"
},
text: true
});
$('a').on('click', function (e) {
e.preventDefault();
});
$('#ddmenu li').hover(function () {
clearTimeout($.data(this, 'timer'));
$('ul', this).stop(true, true).slideDown(200);
}, function () {
$.data(this, 'timer', setTimeout($.proxy(function () {
$('ul', this).stop(true, true).slideUp(200);
}, this), 100));
});
});
</script>
</head>
Following is the code in my Login view, where I (believe I) have the valid references:
@model LayoutTest.Models.LogOnModel
@{
ViewBag.Title = "LogOn";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Log On</h2>
<p>
Please enter your user name and password. @Html.ActionLink("Register", "Register") if you don't have an account.
</p>
<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>
@Html.ValidationSummary(true, "Login was unsuccessful. Please correct the errors and try again.")
Referring to other SO posts, I have added the proper jquery script references, but I am still not able to get this to work. Attached is the error message I get when calling the Logon view:
Unhandled exception at line 48, column 199 in localhost:49436/Scripts/jquery.validate.min.js
0x800a138f - Microsoft JScript runtime error: Unable to get value of the property 'call': object is null or undefined
Upvotes: 1
Views: 2993
Reputation: 1000
It appears that my question is closely related to the post enter link description here unobtrusive validation for mvc3 seems to have gone haywire after version 1.8.3. Also as 2+ jquery does not work for IE8 and below, downgrading from 1.9.1 did the trick for me. Hope someone gets something out of this
Upvotes: 1