Reputation: 2371
i trying to pop up only error message's for validation's control not text. The code which i tried is showing null for error message's.
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 = '';
}
}
}
Upvotes: 1
Views: 343
Reputation: 31077
You can address the error message with val.errormessage
in your code. You don't need to do getAttribute.
Upvotes: 3