jquery validation error in Asp.net MVC - unable to get value of property 'call' : object is null or undefined

前提是你 提交于 2019-12-14 03:52:05

问题


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.

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');

partial view

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

{

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

My viewModel

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

回答1:


Thanks to Slicksim

"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"

That is the solution. Go to a previous Jquery.



来源:https://stackoverflow.com/questions/15749471/jquery-validation-error-in-asp-net-mvc-unable-to-get-value-of-property-call

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!