Custom Error Message Placement

23 views
Skip to first unread message

Steve Blades

unread,
Feb 27, 2013, 8:38:05 PM2/27/13
to valida...@googlegroups.com
I am trying to change the location of where my error messages are being displayed. Currently it is the default jquery.validate settings. I tried adding the following to my page:

$(document).ready(function () {
$.validator.setDefaults({
errorElement: "span",
wrapper: "li",
errorLabelContainer: "ul#errorCont",
invalidHandler: function (form, validator) {
console.log("invalidHandler");
}
});
});

This should have put errors into list items in an unordered list container with the id of "errorCont". It should also write to the console when an invalid form submission occurs. Neither is happening. How do I go about making this type of customization in ValidateThis?

Martijn van der Woud

unread,
Feb 28, 2013, 2:53:15 PM2/28/13
to valida...@googlegroups.com
I do this by providing a custom error placement function to the jquery validation plugin like this:

http://pastebin.com/x61YNThu

Reply all
Reply to author
Forward
0 new messages