I have been pulling my hair out trying to figure this out.
I am running jquery 2.2.2 at the moment with the jquery validation plugin. https://jqueryvalidation.org/ And Trumbowyg WYSIWYG Editor. https://alex-d.github.io/Trumbowyg/
It's great mostly everything works however, every time a use clicks or does anything really. You get the console error Uncaught TypeError: Cannot read property 'nodeName' of undefined
. It also creates certain parts of Trumbowyg to not work properly.
So my solution was to use the ignore class on the jquery validation plugin. But it does not work. I have tried ignoring almost every class labeling for different fields and no matter what I do it is never ignored.
So how do I use the jquery validation plugin, with the trumbowyg text editor?
Here is my validation code.
$('form').validate({
errorPlacement: function (error, element) {
if ($(element).parent('.input-group').length) {
error.insertAfter(element.parent().siblings('label'));
error.addClass('alert alert-danger validate');
} else {
error.insertAfter(element.siblings('label'));
error.addClass('alert alert-danger validate');
}
},
errorElement: 'div',
highlight: function (element) {
$(element).parent().addClass("has-error");
},
unhighlight: function (element) {
$(element).parent().removeClass("has-error");
},
ignore: '.advanced',
rules: {
password_confirm: {
equalTo: 'input[name=password]'
},
user_username: {
remote: {
url: 'action/check/',
type: 'POST',
data: {
id: function () {
return $('input[name=id]').val();
}
}
}
},
nav_name: {
remote: {
url: 'action/check/',
type: 'POST',
data: {
id: function () {
return $('input[name=id]').val();
}
}
}
}
},
messages: {
password_confirm: {
equalTo: "Passwords must match"
},
user_username: {
remote: "This Username already exists"
},
nav_name: {
remote: "This Nav Item Name already exists"
}
},
submitHandler: function (form) {
$('button[type="submit"]').addClass('disabled').prop('disabled', true).prepend('<span class="bootstrap-dialog-button-icon glyphicon glyphicon-asterisk icon-spin"></span>');
form.submit();
}
});
I did remove the validation plugin and everything with trumbowyg did work. So maybe it's time to find a new validation plugin, I really would like to avoid that.
Update: I did notice that firefox is giving me a different error, so I figured I would share that as well.
TypeError: owner is undefined
owner[ this.expando ] && owner[ this.expando ][ key ];
An example of the problem should be available to demo here: http://develop.chrischampeau.com/admin/test.php