Do we have any function which returns all the error messages while validating a form?
I have tried using the defaultshowerros() function but it returns the error message for the element it is currently validating. How can I get all the error messages of the whole form?
If you store a reference to the validator, for example:
You can call
.errors()or.invalidElements()at any time on it, for example:If you’re not really after the errors and just want them to appear in once place, use the built-in
errorLabelContainerandwrapperoptions, for example:And reference that:
And your errors would appear all in that list, which is also automatically shown/hidden if there are/aren’t any errors.