Esempio n. 1
0
        public void EnableDynamicValidation()
        {
            DOMElement[] elements = Elements;
            for (int i = 0; i < elements.Length; i++)
            {
                DOMElement element = elements[i];

                if (ValidationUtil.ElementSupportsEvent(element, "onpropertychange"))
                {
                    // IE

                    // DDB #227842: IE (before version 8) sometimes incorrectly fires the OnPropertyChange event
                    // for 'value' asynchronously when the element's CSS class is changed, which throws our
                    // validation library into an infinite loop and hangs the user's browser. We disable real-
                    // time validation in downlevel versions of IE to prevent this situation.
                    // 'documentMode' documented at http://msdn.microsoft.com/en-us/library/cc196988(VS.85).aspx
                    object compatMode = Script.Literal("document.documentMode");
                    if (compatMode != null && (int)compatMode >= 8)
                    {
                        DomEvent.AddHandler(element, "propertychange", _onPropertyChangeHandler);
                    }
                }
                else
                {
                    // Firefox, Safari, Opera, Chrome
                    DomEvent.AddHandler(element, "input", _onInputHandler);
                }

                // Everybody else
                DomEvent.AddHandler(element, "change", _onChangeHandler);
                DomEvent.AddHandler(element, "blur", _onBlurHandler);
            }
        }
Esempio n. 2
0
 public void EnableDynamicValidation()
 {
     DomEvent.AddHandler(FormElement, "click", _onClickHandler);
     DomEvent.AddHandler(FormElement, "submit", _onSubmitHandler);
 }