Skip to main content

Bug Tracker

Side navigation

#13413 closed bug (notabug)

Opened February 08, 2013 07:02AM UTC

Closed February 13, 2013 11:42PM UTC

Last modified February 13, 2013 11:55PM UTC

Jquery 1.9.1 Error on Dialog Box display PartialView with validation

Reported by: jacob@websiteinstant.com Owned by: jacob@websiteinstant.com
Priority: undecided Milestone: None
Component: unfiled Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:
Description

Please refer to this

http://nickstips.wordpress.com/2011/08/11/asp-net-mvc-ajax-dialog-form-using-jquery-ui/


I've try using Jquery 1.9.1, upgrade for Microsoft jQuery unobtrusive Validation v 2.0.20710.0

I notice that the live method has been removed in 1.9.1 and I have changed the "live" method to "on"

but it give me an error

This is the error message


Unhandled exception at line 63, column 199 in script block

0x800a138f - Microsoft JScript runtime error: Unable to get value of the property 'call': object is null or undefined

If there is a handler for this exception, the program may be safely continued.


but this works fine when using Jquery 1.8.2 (i have no idea whether that dialog works for version 1.83 - 1.9.1)

Thanks for the Support

Attachments (0)
Change History (9)

Changed February 08, 2013 02:21PM UTC by dmethvin comment:1

owner: → jacob@websiteinstant.com
status: newpending

Hi, can you please create a test case on jsfiddle.net or jsbin.com and post a link here so we can see the entire situation? If that's impossible, please provide a link to some other site where we can see the problem. Please use http://code.jquery.com/jquery-git.js which is the latest build.

Changed February 13, 2013 09:58PM UTC by anonymous comment:2

I am also having this problem

Changed February 13, 2013 10:01PM UTC by dmethvin comment:3

Yes, anonymous, but we still need a test case.

Changed February 13, 2013 11:03PM UTC by anonymous comment:4

I've try using Jquery 1.9.1, upgrade for Microsoft jQuery unobtrusive Validation v 2.0.20710.0

Replying to [comment:3 dmethvin]:

Yes, anonymous, but we still need a test case.

My apologies for the earlier response that was less than helpful ...

I tracked this down to the validation plugin did not define the ie focusin and focusout events ... after further research my jquery.validate.min.js was still 1.8.1 ... I upgraded to version 1.11.0 to fix this issue.

Here was my test.html to verify the failure with 1.8.1

<!doctype html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>Test</title>

<script type="text/javascript" src="jquery-1.9.1.min.js" charset="utf-8"></script>

<script type="text/javascript" src="jquery.validate.min.js" charset="utf-8"></script>

<script type="text/javascript" src="jquery.validate.unobtrusive.min.js" charset="utf-8"></script>

</head>

<body>

<form action="/Test" id="frmTest" method="post">

<b>Text: </b>

<input data-val="true" data-val-length-max="20" data-val-length-min="1" data-val-required="The field is required." id="txt" name="txt" tabindex="1" type="text" value="" />

</form>

</body>

</html>

click on the input box to trigger the unobtrusive 'call' that failed on focusin and focusout

Changed February 13, 2013 11:42PM UTC by dmethvin comment:5

resolution: → notabug
status: pendingclosed

This sounds like a plugin issue then. Please try it with the jQuery Migrate plugin and report to the plugin owner. They can get in touch with us if it's a jQuery Core issue.

Changed February 13, 2013 11:48PM UTC by anonymous comment:6

Replying to [comment:5 dmethvin]:

This sounds like a plugin issue then. Please try it with the jQuery Migrate plugin and report to the plugin owner. They can get in touch with us if it's a jQuery Core issue.

Sorry ... this is a jquery issue ... 1.8.x works with the plugins

but the parseJSON function is failing due to invalid null checking

parseJSON: function( data ) {

/ removed in 1.9.1

/ if ( !data || typeof data !== "string") {

/ return null;

/ }

/

/ // Make sure leading/trailing whitespace is removed (IE can't handle it)

/ data = jQuery.trim( data );

/ 1.9.1 starts here

// Attempt to parse using the native JSON parser first

if ( window.JSON && window.JSON.parse ) {

return window.JSON.parse( data );

}

Changed February 13, 2013 11:49PM UTC by anonymous comment:7

you may want to review the parseJSON function in 1.9.1 ...

Changed February 13, 2013 11:52PM UTC by dmethvin comment:8

Okay, then yes that plugin should be changed. An empty string is not valid JSON. The next version of the jQuery Migrate plugin will patch this until the plugin can be fixed.

Changed February 13, 2013 11:55PM UTC by anonymous comment:9

Replying to [comment:8 dmethvin]:

Okay, then yes that plugin should be changed. An empty string is not valid JSON. The next version of the jQuery Migrate plugin will patch this until the plugin can be fixed.

Fair enough, but the most recent Microsoft unobtrusive ajax function is this:

function onError(error, inputElement) { // 'this' is the form element

var container = $(this).find("[data-valmsg-for='" + escapeAttributeValue(inputElement[0].name) + "']"),

replace = $.parseJSON(container.attr("data-valmsg-replace")) !== false;

container.removeClass("field-validation-valid").addClass("field-validation-error");

error.data("unobtrusiveContainer", container);

if (replace) {

container.empty();

error.removeClass("input-validation-error").appendTo(container);

}

else {

error.hide();

}

}

and I don't know when Microsoft will get around to fixing this ...

I'll leave a comment on their site