Asp.net MVC中的jquery验证错误-无法获取属性"call"的值:对象为null或未定义 [英] jquery validation error in Asp.net MVC - unable to get value of property 'call' : object is null or undefined

查看:93
本文介绍了Asp.net MVC中的jquery验证错误-无法获取属性"call"的值:对象为null或未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在客户端进行一些验证检查,但是即使在打开索引页之前,我的ASP.NET MVC应用程序也会失败.我收到错误Microsoft Jscript运行时错误:无法获取属性'call'的值:对象为null或未定义.

I'm trying to do some validation checks on the client side but my ASP.NET MVC application fails even before opening the index page. I get the error Microsoft Jscript runtime error: unable to get value of the property 'call':object is null or undefined.

下面是我的脚本.我正在使用局部视图显示UI对话框来编辑员工.我确保将jqueryval捆绑包添加到_Layout.cshtml并将clientsidevalidation设置为true.任何帮助将不胜感激-谢谢

Below is my script. I'm using partial views to show a UI dialog to edit the employees. I've made sure that the jqueryval bundle is added to the _Layout.cshtml and clientsidevalidation is set true. any help would be greatly appreciated - thanks

var $form = $("#updateEmployeeForm");
$form.unbind();
$form.data("validator", null);
// Check document for changes
$.validator.unobtrusive.parse(document);
// Re add validation with changes
$form.validate($form.data("unobtrusiveValidation").options);
dialogDiv.dialog('open');

局部视图

@using (Ajax.BeginForm("EditEmployee", "Employee", new AjaxOptions
{
  InsertionMode = InsertionMode.Replace, 
  HttpMethod = "POST",
  OnSuccess = "updateSuccess"
}, new { @id = "updateEmployeeForm" }))

{

  @Html.ValidationSummary(true) .....}

我的viewModel

[Required]
public string FirstName { get; set; }
public string MiddleName { get; set;}
[Required]

推荐答案

感谢Slicksim

Thanks to Slicksim

"我相信我在使用asp.net mvc的jQuery> 1.9时已经看到了这一点.请尝试安装jquery 1.8.2,看看是否能解决它.我认为新版本的ajax或验证器没有问题jquery – Slicksim Apr 2 at 10:30"

"I believe i have seen this when using jquery > 1.9 with asp.net mvc. try installing jquery 1.8.2 and see if that solves it. i think there is an issue with the unobtrusive ajax or validator with the new version of jquery – Slicksim Apr 2 at 10:30"

那是解决方案.转到上一个Jquery.

That is the solution. Go to a previous Jquery.

这篇关于Asp.net MVC中的jquery验证错误-无法获取属性"call"的值:对象为null或未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆