-
Notifications
You must be signed in to change notification settings - Fork 111
Closed
Description
When using with MVC I get this error: "0x800a138f - JavaScript runtime error: Unable to get property 'attr' of undefined or null reference". The problem is in "onSuccess": I don't have "unobtrusiveContainer" defined and it throws this exception.
Since you check whether "unobtrusiveContainer" exists or not via "if (container)" I think it makes sense to move "replaceAttrValue = container.attr("data-valmsg-replace")" under "if (container)".
function onSuccess(error) {
var container = error.data("unobtrusiveContainer"),
replaceAttrValue = container.attr("data-valmsg-replace"),
replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) : null;
if (container) {
container.addClass("field-validation-valid").removeClass("field-validation-error");
error.removeData("unobtrusiveContainer");
if (replace) {
container.empty();
}
}
}