New tests, updates
[mono.git] / mcs / class / System.Web / resources / WebUIValidation_2.0.js
index 6884e8b2418a517304f14f89259bfe4d90a3cb5c..085f08d4a248cb4ec5c7927f94636401c6732039 100644 (file)
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-var have_validation_summaries = false;
+function WebFormValidation_Initialize(webForm) {
 
-function ValidatorOnLoad ()
-{
-       if (typeof (Page_ValidationSummaries) != 'undefined' && Page_ValidationSummaries != null) {
-               have_validation_summaries = true;
-           for (var v in Page_ValidationSummaries) {
-                   var vs = Page_ValidationSummaries [v];
-                   if (vs.getAttribute ("validationgroup") == null)
-                           vs.setAttribute ("validationgroup", "");
-           }
-       }
-
-       for (var v in Page_Validators) {
-               var vo = Page_Validators [v];
-               var funcname = vo.getAttribute ("evaluationfunction");
-
-               func = this[funcname];
+webForm.have_validation_summaries = false;
 
-               vo["evaluationfunction"] = func;
-
-               if (vo.getAttribute ("isvalid") == null)
-                       vo.setAttribute ("isvalid", "true");
-
-               if (vo.getAttribute ("enabled") == null)
-                       vo.setAttribute ("enabled", "true");
+webForm.HaveRegexp = function ()
+{
+  if (window.RegExp)
+    return true;
+  return false;
+}
 
-               if (vo.getAttribute ("validationgroup") == null)
-                       vo.setAttribute ("validationgroup", "");
+webForm.ValidatorOnLoad = function  ()
+{
+       if (typeof (webForm.Page_ValidationSummaries) != 'undefined' && webForm.Page_ValidationSummaries != null) {
+               webForm.have_validation_summaries = true;
+       }
 
-               func = vo ["evaluationfunction"];
+       for (var v = 0; v < webForm.Page_Validators.length; v++) {
+               var vo = webForm.Page_Validators [v];
+
+               if (typeof(vo.isvalid) == "string" && vo.isvalid == "False")
+                       vo._isvalid = false;
+               else
+                       vo._isvalid = true;
+
+               if (typeof(vo.enabled) == "string" && vo.enabled == "False")
+                       vo._enabled = false;
+               else
+                       vo._enabled = true;
+                       
+               if (typeof(vo.evaluationfunction) == "string")
+                       vo.evaluationfunction = webForm [vo.evaluationfunction];
        }
 
-       Page_ValidationActive = true;
+       webForm.Page_ValidationActive = true;
 }
 
-var validation_result = true;
+webForm.validation_result = true;
 
-function ValidationSummaryOnSubmit (group)
+webForm.ValidationSummaryOnSubmit = function (group)
 {
        /* handle validation summaries here */
-       if (validation_result == false && have_validation_summaries) {
+       if (webForm.validation_result == false && webForm.have_validation_summaries) {
 
-               for (var vi in Page_ValidationSummaries)  {
-                       var vs = Page_ValidationSummaries[vi];
+         for (var vi = 0; vi < webForm.Page_ValidationSummaries.length; vi++) {
+                       var vs = webForm.Page_ValidationSummaries[vi];
                    
-                   if(IsValidationGroupMatch(vs, group)) {
+                   if(webForm.IsValidationGroupMatch(vs, group)) {
 
-                           var header = vs.getAttribute ("headertext");
-                           if (header == null)
-                                   header = "";
+                           var header = "";
+                           if(typeof(vs.headertext)=="string")
+                                   header = vs.headertext;
 
-                           attr = vs.getAttribute ("showsummary");
-                           if (attr == null || attr.toLowerCase() == "true") {
-                                   var displaymode = vs.getAttribute ("displaymode");
-                                   if (displaymode == null) displaymode = "Bulleted";
+                           if (vs.showsummary != "False") {
+                                       if (typeof(vs.displaymode) != "string")
+                                               vs.displaymode = "BulletList";
 
                                    var html = "";
 
-                                   if (displaymode == "List") {
+                                   if (vs.displaymode == "List") {
                                            list_pre = "";
                                            list_post = "";
                                            item_pre = "";
                                            item_post = "<br>";
                                    }
-                                   else if (displaymode == "SingleParagraph") {
+                                   else if (vs.displaymode == "SingleParagraph") {
                                            list_pre = "";
                                            list_post = "<br>";
                                            item_pre = "";
@@ -106,11 +106,11 @@ function ValidationSummaryOnSubmit (group)
 
                                    html += header;
                                    html += list_pre;
-                                   for (var v in Page_Validators) {
-                                           var vo = Page_Validators [v];
+                                               for (var v = 0; v < webForm.Page_Validators.length; v++) {
+                                     var vo = webForm.Page_Validators [v];
 
-                                           if (vo.getAttribute ("isvalid").toLowerCase() == "false") {
-                                                   var text = ValidatorGetErrorMessage (vo);
+                                           if (!vo._isvalid) {
+                                                   var text = vo.errormessage;
                                                    if (text != null && text != "") {
                                                            html += item_pre + text + item_post;
                                                    }
@@ -122,15 +122,14 @@ function ValidationSummaryOnSubmit (group)
                                    vs.style.display = "block";
                            }
 
-                           attr = vs.getAttribute ("showmessagebox");
-                           if (attr != null && attr.toLowerCase() == "true") {
+                           if (vs.showmessagebox == "True") {
                                    var v_contents = "";
 
-                                   for (var v in Page_Validators) {
-                                           var vo = Page_Validators [v];
+                                               for (var v = 0; v < webForm.Page_Validators.length; v++) {
+                                     var vo = webForm.Page_Validators [v];
 
-                                           if (vo.getAttribute ("isvalid").toLowerCase() == "false") {
-                                                   var text = ValidatorGetErrorMessage (vo);
+                                           if (!vo._isvalid) {
+                                                   var text = vo.errormessage;
                                                    if (text != null && text != "") {
                                                            v_contents += "-" + text + "\n";
                                                    }
@@ -148,16 +147,16 @@ function ValidationSummaryOnSubmit (group)
        }
 }
 
-function ValidatorCommonOnSubmit ()
+webForm.ValidatorCommonOnSubmit = function ()
 {
-       rv = validation_result;
-       validation_result = true;
+       var rv = webForm.validation_result;
+       webForm.validation_result = true;
        return rv;
 }
 
-function ValidatorGetValue (controlname)
+webForm.ValidatorGetValue = function (controlname)
 {
-       var el = GetElement (controlname);
+       var el = webForm.GetElement (controlname);
 
        /* if the element has a 'value' attribute, return it */
        if (typeof (el.value) != 'undefined' && el.value != null) {
@@ -169,9 +168,23 @@ function ValidatorGetValue (controlname)
        if (typeof (el.selectedIndex) != 'undefined') {
                return el.options[el.selectedIndex].value;
        }
+
+       return webForm.ValidatorGetValueRecursive(el);
+}
+
+webForm.ValidatorGetValueRecursive = function (el)
+{
+       if (typeof(el.value) == "string") {
+               if (el.type != "radio" || el.checked == true) return el.value;
+       }
+       for (var i = 0; i<el.childNodes.length; i++) {
+               var val = webForm.ValidatorGetValueRecursive(el.childNodes[i]);
+               if (val != "") return val;
+       }
+       return "";
 }
 
-function ValidatorTrim (s)
+webForm.ValidatorTrim = function (s)
 {
        s = s.replace (/^\s+/g, "");
        s = s.replace (/\s+$/g, "");
@@ -179,66 +192,107 @@ function ValidatorTrim (s)
        return s;
 }
 
-function Page_ClientValidate(group)
+webForm.Page_ClientValidate = function (group)
 {
-       validation_result = true;
+       webForm.validation_result = true;
 
        /* clear out the existing text from all our summaries */
-       if (have_validation_summaries) {
-               for (var vi in Page_ValidationSummaries) {
-                       var vs = Page_ValidationSummaries[vi];
+       if (webForm.have_validation_summaries) {
+         for (var vi = 0; vi < webForm.Page_ValidationSummaries.length; vi++) {
+                       var vs = webForm.Page_ValidationSummaries[vi];
                        vs.style.display = "none";
                        vs.innerHTML = "";
                }
        }
-
-       for (var v in Page_Validators) {
-               var vo = Page_Validators [v];
-               var evalfunc = vo["evaluationfunction"];
+       
+       var invalidControlHasBeenFocused = false;
+       for (var v = 0; v < webForm.Page_Validators.length; v++) {
+               var vo = webForm.Page_Validators [v];
+               var evalfunc = vo.evaluationfunction;
                var result = false;
 
-               if (vo.getAttribute ("enabled").toLowerCase() == "false" || !IsValidationGroupMatch(vo, group)) {
+               if (!vo._enabled || !webForm.IsValidationGroupMatch(vo, group)) {
                        result = true;
-                       ValidatorSucceeded (vo);
+                       webForm.ValidatorSucceeded (vo);
                }
                else {
-                       result = evalfunc (vo);
+                       result = evalfunc.call (this, vo);
                }
 
-               if (!result)
-                       validation_result = false;
-
-               vo.setAttribute("isvalid", result ? "true" : "false");
+               if (!result) {
+                       webForm.validation_result = false;
+                       if (!invalidControlHasBeenFocused && typeof(vo.focusOnError) == "string" && vo.focusOnError == "t") {
+                               invalidControlHasBeenFocused = webForm.ValidatorSetFocus(vo);
+                       }
+               }
+               
+               vo._isvalid = result;
        }
-    ValidationSummaryOnSubmit(group);
-       return validation_result;
+    webForm.ValidationSummaryOnSubmit(group);
+       return webForm.validation_result;
 }
 
-function IsValidationGroupMatch(vo, group) {
-    var valGroup = vo.getAttribute ("validationgroup");
+webForm.IsValidationGroupMatch = function (vo, group) {
+    var valGroup = "";
+    if (typeof(vo.validationGroup) == "string")
+               valGroup = vo.validationGroup;
     if ((typeof(group) == "undefined") || (group == null)) {
         return (valGroup == "");
     }
     return (valGroup == group);
 }
 
+webForm.ValidatorSetFocus = function (val) {
+    var ctrl = webForm.GetElement(val.controltovalidate);
+       if ((typeof(ctrl) != "undefined") && (ctrl != null) &&
+               ((ctrl.tagName.toLowerCase() != "input") || (ctrl.type.toLowerCase() != "hidden")) &&
+               (typeof(ctrl.disabled) == "undefined" || ctrl.disabled == null || ctrl.disabled == false) &&
+               (typeof(ctrl.visible) == "undefined" || ctrl.visible == null || ctrl.visible != false) &&
+               (webForm.IsInVisibleContainer(ctrl))) {
+               if (ctrl.tagName.toLowerCase() == "table") {
+                       var inputElements = ctrl.getElementsByTagName("input");
+                       var lastInputElement  = inputElements[inputElements.length -1];
+                       if (lastInputElement != null) {
+                               ctrl = lastInputElement;
+                       }
+               }
+               if (typeof(ctrl.focus) != "undefined" && ctrl.focus != null) {
+                       ctrl.focus();
+                       return true;
+               }
+    }
+    return false;
+}
+
+webForm.IsInVisibleContainer = function (ctrl) {
+       if (typeof(ctrl.style) != "undefined" && 
+               ((typeof(ctrl.style.display) != "undefined" &&  ctrl.style.display == "none") ||
+               (typeof(ctrl.style.visibility) != "undefined" && ctrl.style.visibility == "hidden"))) {
+               return false;
+       }
+       else if (typeof(ctrl.parentNode) != "undefined" && ctrl.parentNode != null && ctrl.parentNode != ctrl) {
+               return webForm.IsInVisibleContainer(ctrl.parentNode);
+       }
+       return true;
+}
+
 /*******************/
 /* type converters */
 
-function ToInteger (s)
+webForm.ToInteger = function  (s, validator)
 {
-       if ((v = parseInt(s, 10)) != s - 0)
+       if (s.match(/^\s*[-\+]?\d+\s*$/) == null)
                return null;
-       else
-               return v;
+       var v = parseInt(s, 10);
+       return (isNaN(v) ? null : v);
 }
 
-function ToString (s)
+webForm.ToString = function (s, validator)
 {
        return s;
 }
 
-function ToDouble (s)
+webForm.ToDouble = function (s, validator)
 {
        if ((v = parseFloat(s)) != s - 0)
                return null;
@@ -246,41 +300,108 @@ function ToDouble (s)
                return v;
 }
 
-function ToDate (s)
+webForm.ToDate = function (s, validator)
 {
-       /* NYI */
-       return null;
+    if (!webForm.HaveRegexp ())
+        return null;
+    var m, day, month, year;
+    var yearFirstExp = new RegExp("^\\s*((\\d{4})|(\\d{2}))([-/]|\\. ?)(\\d{1,2})\\4(\\d{1,2})\\s*$");
+    m = s.match(yearFirstExp);
+    if (m != null && (m[2].length == 4 || validator.dateorder == "ymd")) {
+        day = m[6];
+        month = m[5];
+        year = (m[2].length == 4) ? m[2] : webForm.GetFullYear(parseInt(m[3], 10), validator.cutoffyear)
+    }
+    else {
+        if (validator.dateorder == "ymd") return null;
+        var yearLastExp = new RegExp("^\\s*(\\d{1,2})([-/]|\\. ?)(\\d{1,2})\\2((\\d{4})|(\\d{2}))\\s*$");
+        m = s.match(yearLastExp);
+        if (m == null) return null;
+        if (validator.dateorder == "mdy") {
+            day = m[3];
+            month = m[1];
+        }
+        else {
+            day = m[1];
+            month = m[3];
+        }
+        year = (m[5].length == 4) ? m[5] : webForm.GetFullYear(parseInt(m[6], 10), validator.cutoffyear)
+    }
+    month -= 1;
+    var date = new Date(year, month, day);
+    return (typeof(date) == "object" && year == date.getFullYear() && month == date.getMonth() && day == date.getDate()) ? date.valueOf() : null;
 }
 
-function ToCurrency (s)
+webForm.ToCurrency = function (s, validator)
 {
-       /* NYI */
-       return null;
+  if (!webForm.HaveRegexp ())
+    return null;
+  
+       var hasDigits = (validator.digits > 0);
+       var beginGroupSize, subsequentGroupSize;
+       var groupSizeNum = parseInt(validator.groupsize, 10);
+       if (!isNaN(groupSizeNum) && groupSizeNum > 0) {
+               beginGroupSize = "{1," + groupSizeNum + "}";
+               subsequentGroupSize = "{" + groupSizeNum + "}";
+       }
+       else {
+               beginGroupSize = subsequentGroupSize = "+";
+       }
+       var exp = new RegExp("^\\s*([-\\+])?((\\d" + beginGroupSize + "(\\" + validator.groupchar + "\\d" + subsequentGroupSize + ")+)|\\d*)"
+                                       + (hasDigits ? "\\" + validator.decimalchar + "?(\\d{0," + validator.digits + "})" : "")
+                                       + "\\s*$");
+       var m = s.match(exp);
+       if (m == null)
+               return null;
+       if (m[2].length == 0 && hasDigits && m[5].length == 0)
+               return null;
+       var cleanInput = (m[1] != null ? m[1] : "") + m[2].replace(new RegExp("(\\" + validator.groupchar + ")", "g"), "") + ((hasDigits && m[5].length > 0) ? "." + m[5] : "");
+       var num = parseFloat(cleanInput);
+       return (isNaN(num) ? null : num);
+}
+
+webForm.GetFullYear = function (year, maxYear)
+{
+    var twoDigitMaxYear = maxYear % 100;
+    var centure = maxYear - twoDigitMaxYear;
+    return ((year > twoDigitMaxYear) ? (centure - 100 + year) : (centure + year));
 }
 
 /*******************/
 /* validators    */
 
-function CompareValidatorEvaluateIsValid (validator)
+webForm.CompareValidatorEvaluateIsValid = function (validator)
 {
-       var ControlToCompare = validator.getAttribute ("controltocompare");
-       var ValueToCompare = validator.getAttribute ("valuetocompare");
-       var Operator = validator.getAttribute ("operator").toLowerCase();
-       var ControlToValidate = validator.getAttribute ("controltovalidate");
-       var DataType = validator.getAttribute ("datatype");
-
-       var ctrl_value = ValidatorTrim (ValidatorGetValue (ControlToValidate));
-       var compare = (ControlToCompare != null && ControlToCompare != "") ? ValidatorTrim (ValidatorGetValue (ControlToCompare)) : ValueToCompare;
+       var Operator = validator.operator.toLowerCase();
+       var ControlToValidate = validator.controltovalidate;
+       var DataType = validator.type;
 
-       var left = Convert (ctrl_value, DataType);
+       var ctrl_value = webForm.ValidatorGetValue (ControlToValidate);
+       if (webForm.ValidatorTrim (ctrl_value) == "") {
+               webForm.ValidatorSucceeded (validator);
+               return true;
+       }
+       
+       var left = webForm.Convert (ctrl_value, DataType, validator);
        if (left == null) {
-               ValidatorFailed (validator);
+               webForm.ValidatorFailed (validator);
                return false;
        }
+       
+       if (Operator == "datatypecheck") {
+               webForm.ValidatorSucceeded (validator);
+               return true;
+       }
       
-       var right = Convert (compare, DataType);
+       var compare = "";
+       if (typeof(validator.controltocompare) == "string" && document.getElementById(validator.controltocompare))
+               compare = webForm.ValidatorGetValue(validator.controltocompare);
+       else if (typeof(validator.valuetocompare) == "string")
+               compare = validator.valuetocompare;
+
+       var right = compare != null ? webForm.Convert (compare, DataType, validator) : null;
        if (right == null) {
-               ValidatorSucceeded (validator);
+               webForm.ValidatorSucceeded (validator);
                 return true;
        }
 
@@ -306,109 +427,113 @@ function CompareValidatorEvaluateIsValid (validator)
        }
 
        if (result == false) {
-               ValidatorFailed (validator);
+               webForm.ValidatorFailed (validator);
                return false;
        }
        else {
-               ValidatorSucceeded (validator);
+               webForm.ValidatorSucceeded (validator);
                return true;
        }
 }
 
-function RangeValidatorEvaluateIsValid (validator)
+webForm.RangeValidatorEvaluateIsValid = function (validator)
 {
-       var MinimumValue = parseInt (validator.getAttribute ("minimumvalue"));
-       var MaximumValue = parseInt (validator.getAttribute ("maximumvalue"));
-       var ControlToValidate = validator.getAttribute ("controltovalidate");
-       var DataType = validator.getAttribute ("datatype");
+       var ControlToValidate = validator.controltovalidate;
+       var DataType = validator.type;
 
-       var ctrl_value = ValidatorTrim (ValidatorGetValue (ControlToValidate));
+       var ctrl_value = webForm.ValidatorTrim (webForm.ValidatorGetValue (ControlToValidate));
 
        if (ctrl_value == "") {
-               ValidatorSucceeded (validator);
+               webForm.ValidatorSucceeded (validator);
                return true;
        }
 
-       var val = Convert (ctrl_value, DataType);
+       var MinimumValue = webForm.Convert (validator.minimumvalue, DataType, validator);
+       var MaximumValue = webForm.Convert (validator.maximumvalue, DataType, validator);
+       var val = webForm.Convert (ctrl_value, DataType, validator);
        if (val == null || val < MinimumValue || val > MaximumValue) {
-               ValidatorFailed (validator);
+               webForm.ValidatorFailed (validator);
                return false;
        }
        else {
-               ValidatorSucceeded (validator);
+               webForm.ValidatorSucceeded (validator);
                return true;
        }
 }
 
-function RegularExpressionValidatorEvaluateIsValid (validator)
+webForm.RegularExpressionValidatorEvaluateIsValid = function (validator)
 {
-       var ValidationExpression = validator.getAttribute ("validationexpression");
-       var ControlToValidate = validator.getAttribute ("controltovalidate");
+       var ValidationExpression = validator.validationexpression;
+       var ControlToValidate = validator.controltovalidate;
 
-       var ctrl_value = ValidatorTrim (ValidatorGetValue (ControlToValidate));
+       var ctrl_value = webForm.ValidatorTrim (webForm.ValidatorGetValue (ControlToValidate));
 
        if (ctrl_value == "") {
-               ValidatorSucceeded (validator);
+               webForm.ValidatorSucceeded (validator);
                return true;
        }
 
+  if (!webForm.HaveRegexp ())
+    return false;
+  
        var r = new RegExp (ValidationExpression);
        match = r.exec (ctrl_value);
-       if (match == null || match[0] == "") {
-               ValidatorFailed (validator);
+       if (match == null || match[0] != ctrl_value) {
+               webForm.ValidatorFailed (validator);
                return false;
        }
        else {
-               ValidatorSucceeded (validator);
+               webForm.ValidatorSucceeded (validator);
                return true;
        }
 }
 
-function RequiredFieldValidatorEvaluateIsValid (validator)
+webForm.RequiredFieldValidatorEvaluateIsValid = function (validator)
 {
-       var InitialValue = validator.getAttribute ("initialvalue");
-       var ControlToValidate = validator.getAttribute ("controltovalidate");
+       var InitialValue = validator.initialvalue;
+       var ControlToValidate = validator.controltovalidate;
 
-       var ctrl_value = ValidatorTrim (ValidatorGetValue (ControlToValidate));
+       var ctrl_value = webForm.ValidatorTrim (webForm.ValidatorGetValue (ControlToValidate));
 
-       if (ctrl_value == ValidatorTrim (InitialValue)) {
-               ValidatorFailed (validator);
+       if (ctrl_value == webForm.ValidatorTrim (InitialValue)) {
+               webForm.ValidatorFailed (validator);
                return false;
        }
        else {
-               ValidatorSucceeded (validator);
+               webForm.ValidatorSucceeded (validator);
                return true;
        }
 }
 
-function CustomValidatorEvaluateIsValid (validator)
+webForm.CustomValidatorEvaluateIsValid = function (validator)
 {
-       var InitialValue = validator.getAttribute ("initialvalue");
-       var ControlToValidate = validator.getAttribute ("controltovalidate");
+       var ControlToValidate = validator.controltovalidate;
+       var evaluationfunc = validator.clientvalidationfunction;
+       var ctrl_value;
 
-       if (!ControlToValidate) {
-               ValidatorSucceeded (validator);
-               return true;
-       }
-
-       var evaluationfunc = validator.getAttribute ("clientvalidationfunction");
-
-       var ctrl_value = ValidatorTrim (ValidatorGetValue (ControlToValidate));
+       if (ControlToValidate) {
+           ctrl_value = webForm.ValidatorTrim (webForm.ValidatorGetValue (ControlToValidate));
 
+           if ((ctrl_value.length == 0) && ((typeof(validator.validateemptytext) != "string") || (validator.validateemptytext != "true"))) {
+               webForm.ValidatorSucceeded (validator);
+               return true;
+           }
+       } else
+           ctrl_value = "";
        var result = true;
 
        if (evaluationfunc && evaluationfunc != "") {
-               args = {Value:ctrl_value, IsValid:false};
+               args = {Value:ctrl_value, IsValid:true};
                eval (evaluationfunc + "(validator, args)");
                result = args.IsValid;
        }
 
        if (result) {
-               ValidatorSucceeded (validator);
+               webForm.ValidatorSucceeded (validator);
                return true;
        }
        else {
-               ValidatorFailed (validator);
+               webForm.ValidatorFailed (validator);
                return false;
        }
 }
@@ -416,18 +541,18 @@ function CustomValidatorEvaluateIsValid (validator)
 /*********************/
 /* utility functions */
 
-function Convert (s, ty)
+webForm.Convert = function (s, ty, validator)
 {
        var cvt = this ["To" + ty];
        if (typeof (cvt) == 'function')
-               return cvt (s);
+               return cvt.call (this, s, validator);
        else
                return null;
 }
 
-function ValidatorUpdateDisplay (v, valid)
+webForm.ValidatorUpdateDisplay = function (v, valid)
 {
-       var display = v.getAttribute ("display");
+       var display = v.display;
 
        /* for validators that aren't displayed, do nothing */
        if (display == "None") {
@@ -440,44 +565,22 @@ function ValidatorUpdateDisplay (v, valid)
        }
 }
 
-function ValidatorGetErrorMessage (v)
-{
-       var text = v.getAttribute ("errormessage");
-       if (text == null || text == "")
-               text = v.getAttribute ("text"); 
-       if (text == null)
-               text = "";
-       return text;
-}
-
-function ValidatorGetText (v)
+webForm.ValidatorFailed = function  (v)
 {
-       var text = v.getAttribute ("text");     
-       if (text == null || text == "")
-               text = v.getAttribute ("errormessage");
-       if (text == null)
-               text = "";
-       return text;
+       webForm.ValidatorUpdateDisplay (v, false);
 }
 
-function ValidatorFailed (v)
+webForm.ValidatorSucceeded = function  (v)
 {
-       var text = ValidatorGetText (v);
-       v.innerHTML = text;
-
-       ValidatorUpdateDisplay (v, false);
-}
-
-function ValidatorSucceeded (v)
-{
-       v.innerHTML = "";
-
-       ValidatorUpdateDisplay (v, true);
+       webForm.ValidatorUpdateDisplay (v, true);
 }
 
-function GetElement(id)
+webForm.GetElement = function (id)
 {
        var x = document.getElementById ? document.getElementById (id) :
                                          ((document.all) ? document.all [id] : null);
        return x;
 }
+
+
+}