commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r367089 - in /jakarta/commons/proper/validator/trunk: src/javascript/org/apache/commons/validator/javascript/ xdocs/
Date Sun, 08 Jan 2006 20:30:53 GMT
Author: niallp
Date: Sun Jan  8 12:30:36 2006
New Revision: 367089

URL: http://svn.apache.org/viewcvs?rev=367089&view=rev
Log:
Fix for bug 37134 - Resolve issue in JavaScript validation when the prototype library - based
on patch from Philippe Mouawad

Modified:
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateByte.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateCreditCard.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateDate.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateEmail.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateFloat.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateFloatRange.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateIntRange.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateInteger.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMask.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMaxLength.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMinLength.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateRequired.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateShort.js
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateUtilities.js
    jakarta/commons/proper/validator/trunk/xdocs/changes.xml

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateByte.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateByte.js?rev=367089&r1=367088&r2=367089&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateByte.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateByte.js
Sun Jan  8 12:30:36 2006
@@ -12,9 +12,12 @@
         var i = 0;
         var fields = new Array();
         
-        oByte = eval('new ' + retrieveFormName(form) + '_ByteValidations()');
+        var oByte = eval('new ' + retrieveFormName(form) + '_ByteValidations()');
 
-        for (x in oByte) {
+        for (var x in oByte) {
+            if (!jcv_verifyArrayElement(x, oByte[x])) {
+                continue;
+            }
             var field = form[oByte[x][0]];
 
             if ((field.type == 'hidden' ||

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateCreditCard.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateCreditCard.js?rev=367089&r1=367088&r2=367089&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateCreditCard.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateCreditCard.js
Sun Jan  8 12:30:36 2006
@@ -12,9 +12,12 @@
         var i = 0;
         var fields = new Array();
  
-        oCreditCard = eval('new ' + retrieveFormName(form) +  '_creditCard()');
+        var oCreditCard = eval('new ' + retrieveFormName(form) +  '_creditCard()');
 
-        for (x in oCreditCard) {
+        for (var x in oCreditCard) {
+            if (!jcv_verifyArrayElement(x, oCreditCard[x])) {
+                continue;
+            }
             if ((form[oCreditCard[x][0]].type == 'text' ||
                  form[oCreditCard[x][0]].type == 'textarea') &&
                 (form[oCreditCard[x][0]].value.length > 0)  &&

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateDate.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateDate.js?rev=367089&r1=367088&r2=367089&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateDate.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateDate.js
Sun Jan  8 12:30:36 2006
@@ -12,9 +12,12 @@
        var i = 0;
        var fields = new Array();
  
-       oDate = eval('new ' + retrieveFormName(form) +  '_DateValidations()');
+       var oDate = eval('new ' + retrieveFormName(form) +  '_DateValidations()');
 
-       for (x in oDate) {
+       for (var x in oDate) {
+            if (!jcv_verifyArrayElement(x, oDate[x])) {
+                continue;
+            }
            var field = form[oDate[x][0]];
            var value = field.value;
            var isStrict = true;

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateEmail.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateEmail.js?rev=367089&r1=367088&r2=367089&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateEmail.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateEmail.js
Sun Jan  8 12:30:36 2006
@@ -12,9 +12,12 @@
         var i = 0;
         var fields = new Array();
 
-        oEmail = eval('new ' + retrieveFormName(form) +  '_email()');
+        var oEmail = eval('new ' + retrieveFormName(form) +  '_email()');
 
-        for (x in oEmail) {
+        for (var x in oEmail) {
+            if (!jcv_verifyArrayElement(x, oEmail[x])) {
+                continue;
+            }
             var field = form[oEmail[x][0]];
             if ((field.type == 'hidden' || 
                  field.type == 'text' ||

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateFloat.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateFloat.js?rev=367089&r1=367088&r2=367089&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateFloat.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateFloat.js
Sun Jan  8 12:30:36 2006
@@ -12,8 +12,11 @@
         var i = 0;
         var fields = new Array();
  
-        oFloat = eval('new ' + retrieveFormName(form) +  '_FloatValidations()');
-        for (x in oFloat) {
+        var oFloat = eval('new ' + retrieveFormName(form) +  '_FloatValidations()');
+        for (var x in oFloat) {
+            if (!jcv_verifyArrayElement(x, oFloat[x])) {
+                continue;
+            }
         	var field = form[oFloat[x][0]];
         	
             if ((field.type == 'hidden' ||

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateFloatRange.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateFloatRange.js?rev=367089&r1=367088&r2=367089&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateFloatRange.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateFloatRange.js
Sun Jan  8 12:30:36 2006
@@ -12,8 +12,11 @@
         var i = 0;
         var fields = new Array();
         
-        oRange = eval('new ' + retrieveFormName(form) +  '_floatRange()');
-        for (x in oRange) {
+        var oRange = eval('new ' + retrieveFormName(form) +  '_floatRange()');
+        for (var x in oRange) {
+            if (!jcv_verifyArrayElement(x, oRange[x])) {
+                continue;
+            }
             var field = form[oRange[x][0]];
             
             if ((field.type == 'hidden' ||

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateIntRange.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateIntRange.js?rev=367089&r1=367088&r2=367089&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateIntRange.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateIntRange.js
Sun Jan  8 12:30:36 2006
@@ -12,8 +12,11 @@
         var i = 0;
         var fields = new Array();
  
-        oRange = eval('new ' + retrieveFormName(form) +  '_intRange()');        
-        for (x in oRange) {
+        var oRange = eval('new ' + retrieveFormName(form) +  '_intRange()');        
+        for (var x in oRange) {
+            if (!jcv_verifyArrayElement(x, oRange[x])) {
+                continue;
+            }
             var field = form[oRange[x][0]];
             if (field.disabled == false)  {
                 var value = '';

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateInteger.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateInteger.js?rev=367089&r1=367088&r2=367089&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateInteger.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateInteger.js
Sun Jan  8 12:30:36 2006
@@ -12,8 +12,11 @@
         var i = 0;
         var fields = new Array();
  
-        oInteger = eval('new ' + retrieveFormName(form) +  '_IntegerValidations()');
-        for (x in oInteger) {
+        var oInteger = eval('new ' + retrieveFormName(form) +  '_IntegerValidations()');
+        for (var x in oInteger) {
+            if (!jcv_verifyArrayElement(x, oInteger[x])) {
+                continue;
+            }
             var field = form[oInteger[x][0]];
 
             if ((field.type == 'hidden' ||

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMask.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMask.js?rev=367089&r1=367088&r2=367089&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMask.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMask.js
Sun Jan  8 12:30:36 2006
@@ -12,8 +12,11 @@
         var i = 0;
         var fields = new Array();
  
-        oMasked = eval('new ' + retrieveFormName(form) +  '_mask()');      
-        for (x in oMasked) {
+        var oMasked = eval('new ' + retrieveFormName(form) +  '_mask()');      
+        for (var x in oMasked) {
+            if (!jcv_verifyArrayElement(x, oMasked[x])) {
+                continue;
+            }
             var field = form[oMasked[x][0]];
 
             if ((field.type == 'hidden' ||

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMaxLength.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMaxLength.js?rev=367089&r1=367088&r2=367089&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMaxLength.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMaxLength.js
Sun Jan  8 12:30:36 2006
@@ -15,8 +15,11 @@
         var i = 0;
         var fields = new Array();
  
-        oMaxLength = eval('new ' + retrieveFormName(form) +  '_maxlength()');        
-        for (x in oMaxLength) {
+        var oMaxLength = eval('new ' + retrieveFormName(form) +  '_maxlength()');       

+        for (var x in oMaxLength) {
+            if (!jcv_verifyArrayElement(x, oMaxLength[x])) {
+                continue;
+            }
             var field = form[oMaxLength[x][0]];
 
             if ((field.type == 'hidden' ||

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMinLength.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMinLength.js?rev=367089&r1=367088&r2=367089&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMinLength.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateMinLength.js
Sun Jan  8 12:30:36 2006
@@ -15,9 +15,12 @@
         var i = 0;
         var fields = new Array();
 
-        oMinLength = eval('new ' + retrieveFormName(form) +  '_minlength()');
+        var oMinLength = eval('new ' + retrieveFormName(form) +  '_minlength()');
 
-        for (x in oMinLength) {
+        for (var x in oMinLength) {
+            if (!jcv_verifyArrayElement(x, oMinLength[x])) {
+                continue;
+            }
             var field = form[oMinLength[x][0]];
 
             if ((field.type == 'hidden' ||

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateRequired.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateRequired.js?rev=367089&r1=367088&r2=367089&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateRequired.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateRequired.js
Sun Jan  8 12:30:36 2006
@@ -13,9 +13,12 @@
         var i = 0;
         var fields = new Array();
 
-        oRequired = eval('new ' + retrieveFormName(form) +  '_required()');
+        var oRequired = eval('new ' + retrieveFormName(form) +  '_required()');
 
-        for (x in oRequired) {
+        for (var x in oRequired) {
+            if (!jcv_verifyArrayElement(x, oRequired[x])) {
+                continue;
+            }
             var field = form[oRequired[x][0]];
 
             if (field == null) {

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateShort.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateShort.js?rev=367089&r1=367088&r2=367089&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateShort.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateShort.js
Sun Jan  8 12:30:36 2006
@@ -12,9 +12,12 @@
         var i = 0;
         var fields = new Array();
  
-        oShort = eval('new ' + retrieveFormName(form) +  '_ShortValidations()');
+        var oShort = eval('new ' + retrieveFormName(form) +  '_ShortValidations()');
 
-        for (x in oShort) {
+        for (var x in oShort) {
+            if (!jcv_verifyArrayElement(x, oShort[x])) {
+                continue;
+            }
             var field = form[oShort[x][0]];
 
             if ((field.type == 'hidden' ||

Modified: jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateUtilities.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateUtilities.js?rev=367089&r1=367088&r2=367089&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateUtilities.js
(original)
+++ jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateUtilities.js
Sun Jan  8 12:30:36 2006
@@ -65,6 +65,23 @@
   }
 
   /**
+   * Checks that the array element is a valid
+   * Commons Validator element and not one inserted by
+   * other JavaScript libraries (for example the
+   * prototype library inserts an "extends" into
+   * all objects, including Arrays).
+   * @param name The element name.
+   * @param value The element value.
+   */
+  function jcv_verifyArrayElement(name, element) {
+      if (element && element.length && element.length == 3) {
+          return true;
+      } else {
+          return false;
+      }
+  }
+
+  /**
    * Check a value only contains valid numeric digits
    * @param argvalue The value to check.
    */

Modified: jakarta/commons/proper/validator/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/xdocs/changes.xml?rev=367089&r1=367088&r2=367089&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/xdocs/changes.xml (original)
+++ jakarta/commons/proper/validator/trunk/xdocs/changes.xml Sun Jan  8 12:30:36 2006
@@ -39,6 +39,10 @@
   <body>
 
     <release version="1.2.1 (alpha)" date="in SVN">
+      <action dev="niallp" type="fix" issue="37134" due-to="Philippe Mouawad">
+         Resolve issue in JavaScript validation when the prototype library
+         is used.
+      </action>
       <action dev="niallp" type="fix">
          Re-factor JavaScript error handling into a common method and only
          set focus on fields which are not 'hidden' type or hidden by CSS.



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message