I am using the highlight option in the validator to assign a class to my element and I want to pop a qtip with teh error message, how can I get the offending element's error message from this part of the code? Example is below.
var validator = $("#form1").validate
(
{
rules:
{
PurchaseOrderNumber: { required: true }
},
messages:
{
PurchaseOrderNumber: "You must enter a reference"
},
highlight: function(element, errorClass)
{
$(element).parent().parent().addClass("invalid");
var targetCorner = "rightMiddle", tipCorner = "leftBottom", tipX = 10, tipY = 5;
var sError = "NEED TO GET THE RIGHT MESSAGE HERE!";
$(element).qtip({
content: sError,
style: { padding: 1, border: { width: 1, radius: 2 }, name: 'red', 'font-family': 'Arial', 'font-size': '8pt', tip: { corner: tipCorner, size: { x: tipX, y: tipY}} },
position: { corner: { target: targetCorner, tooltip: tipCorner} },
show: { when: 'focus', ready: true },
hide: { when: 'never' }
});
$(element).qtip('show');
},
unhighlight: function(element, errorClass)
{
$(element).parent().parent().removeClass("invalid");
$(element).qtip("hide");
$(element).qtip("disable");
}
})