#13413 closed bug (notabug)
Jquery 1.9.1 Error on Dialog Box display PartialView with validation
Reported by: | Owned by: | ||
---|---|---|---|
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
Change History (9)
comment:1 Changed 10 years ago by
Owner: | set to [email protected]… |
---|---|
Status: | new → pending |
comment:4 Changed 10 years ago by
I've try using Jquery 1.9.1, upgrade for Microsoft jQuery unobtrusive Validation v 2.0.20710.0
Replying to 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
comment:5 follow-up: 6 Changed 10 years ago by
Resolution: | → notabug |
---|---|
Status: | pending → closed |
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.
comment:6 Changed 10 years ago by
Replying to 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
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 );
}
comment:8 follow-up: 9 Changed 10 years ago by
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.
comment:9 Changed 10 years ago by
Replying to 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
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.