Update of /var/cvs/html/mmbase/validation
In directory james.mmbase.org:/tmp/cvs-serv9699

Modified Files:
      Tag: MMBase-1_8
        validation.js.jsp 
Log Message:
added a method to remove validation bindings


See also: http://cvs.mmbase.org/viewcvs/html/mmbase/validation


Index: validation.js.jsp
===================================================================
RCS file: /var/cvs/html/mmbase/validation/validation.js.jsp,v
retrieving revision 1.11.2.23
retrieving revision 1.11.2.24
diff -u -b -r1.11.2.23 -r1.11.2.24
--- validation.js.jsp   3 Apr 2008 16:23:12 -0000       1.11.2.23
+++ validation.js.jsp   4 Apr 2008 10:16:20 -0000       1.11.2.24
@@ -10,7 +10,7 @@
  *                              then call validator.setup(window[,root]).
  *
  * @author Michiel Meeuwissen
- * @version $Id: validation.js.jsp,v 1.11.2.23 2008/04/03 16:23:12 michiel Exp 
$
+ * @version $Id: validation.js.jsp,v 1.11.2.24 2008/04/04 10:16:20 michiel Exp 
$
  */
 var validators = new Array();
 
@@ -43,7 +43,7 @@
     this.dataTypeCache   = new Object();
     this.invalidElements = 0;
     //this.changedElements  = 0;
-    this.elements        = new Array();
+    this.elements        = [];
     this.validateHook;
     this.setup(w);
     this.root = root;
@@ -778,6 +778,28 @@
     return this.invalidElements == 0;
 }
 
+MMBaseValidator.prototype.removeValidation = function(el) {
+    if (el == null) {
+        el = document.documentElement;
+    }
+    var self = this;
+    var els = $(el).find(".mm_validate *").each(function() {
+       var entry = this;
+       if ($.inArray(entry(self.elements))) {
+           if (! entry.prevValid) self.invalidElements--;
+           $(entry).unbind();
+           var newElements = [];
+           $(self.elements).each(function() {
+               if (this != entry) {
+                   newWlements.push(this);
+               }
+           });
+           self.elements = newElements;
+       }
+    });
+
+}
+
 /**
  * Adds event handlers to all mm_validate form entries
  */
_______________________________________________
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to