// Install the summary output
(function($) {
var // Erroneous refers to an input with an invalid value,
// not the error message itself.
erroneous = "error-border",
// Selector for erroneous inputs.
errors = "." + erroneous,
hasError = false;
var errorMsg = '';
var focusObj = null;
$.validity.outputs.showErr = {
start:function() {
errorMsg = '';
focusObj = null;
$(errors).removeClass(erroneous);
},
end:function(results) {
if(results.errors > 0){
errorMsg = '
' + errorMsg + '
';
alert(errorMsg,'warning',function(){
if(focusObj.attr("class").indexOf("jcalendar") == -1){
focusObj.focus();
}
$('[placeholder]').each(function() {
var placeholderVal = $(this).attr('placeholder');
var value = $(this).val();
if (placeholderVal == value && !$(this).hasClass('placeholder')) {
$(this).addClass('placeholder');
}
});
});
}
hasError = false;
},
raise:function($obj, msg) {
if(focusObj == null){
focusObj = $obj;
}
errorMsg += msg + '
';
if ($obj.is(':password:hidden')) {
$obj = $obj.prev();
}
$obj.addClass(erroneous);
},
raiseAggregate:function($obj, msg) {
if(hasError == false){
this.raise($obj, msg);
hasError = true;
}
}
};
})(jQuery);