I added the following code to cb.validator.php around line 58 to make a pop-up message if validation fails.
Code:
$('#cbcheckedadminForm').submit( function() {
var v = $(this).validate();
v.cbIsFormSubmitting = true;
var r = $(this).validate().form();
v.cbIsFormSubmitting = false;
if ( ! r ) {
//Start of added code
var messages = "Error with one or more entries:\n";
for ( var i = 0; v.errorList[i]; i++ ) {
messages += v.errorList[i].element.name + ": " + v.errorList[i].message + "\n";
}
alert( messages );
//End of added code
$(this).validate().focusInvalid();
}
return r;
} );
Instead of v.errorList
.element.name, which pulls the name attribute from the HTML input element, I'd like to somehow pull the field title from the corresponding CB field. Is that possible, and if so, how would I do that?
Thanks for the help.