How to see jQuery validation list of elements with errors
37,769
Solution 1
var validator = $("form").validate()
validator.errorList
will show the array of errors that are holding back the form from submiting.
Solution 2
This works for me to get a list of validation errors (ids of error inputs and associated error message):
if ($('#form').valid()) {
console.log('FORM VALID');
} else {
console.log('FORM INVALID');
var validator = $('#form').validate();
$.each(validator.errorMap, function (index, value) {
console.log('Id: ' + index + ' Message: ' + value);
});
}
Solution 3
var val = $("#form".validate());
console.log("error list", val);
for those who dont get errorList working that way, just go to console and click on the errorList
![Dragos Durlut](https://i.stack.imgur.com/XRxBE.jpg?s=256&g=1)
Author by
Dragos Durlut
programmer in ASP.NET C# - WebForms and MVC, Angular 5, MSSQL Server
Updated on August 16, 2020Comments
-
Dragos Durlut almost 4 years
Sometimes, the form won't submit because jQuery has some invalid elements that will not show up in an error message.
How can we see these errors in order to debug more easily ?