Question

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 = '';
                }
            }
        }
Was it helpful?

Solution

You can address the error message with val.errormessage in your code. You don't need to do getAttribute.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top