Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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]
like image 952
Ren Avatar asked Feb 01 '26 04:02

Ren


1 Answers

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.

like image 146
dfortun Avatar answered Feb 02 '26 16:02

dfortun



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!