How can I display only error messages for validation controls, not the text itself? The code I have tried is displaying null for error messages.
function fnOnUpdateValidators() {
for (var i = 0; i < Page_Validators.length; i++) {
var val = Page_Validators[i];
var ctrl = document.getElementById(val.controltovalidate);
if (ctrl != null && ctrl.style != null) {
if (!val.isvalid) {
ctrl.style.background = '#FFD6AD';
var errMsg = document.getElementById(val.id).getAttribute('ErrorMessage');
alert(errMsg);
} else {
ctrl.style.backgroundColor = '';
}
}
}
}