commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "rleland@apache.org" <lel...@speakeasy.net>
Subject Re: cvs commit: jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript validateUtilities.js validateByte.js validateCreditCard.js validateDate.js validateEmail.js validateFloat.js validateFloatRange.js validateIntRange.js validateInteger.js validateMask.js validateMaxLength.js validateMinLength.js validateRequired.js validateShort.js
Date Fri, 26 Mar 2004 17:19:59 GMT
I realized that after making this patch that there is a DOM
javascript call called getAttribute()  that will probably
work better than what I created. What I have will be succeptable
to attribute hiding by an html element named 'attributes' which
I am sure exists in somebody's ActionForm.


> -----Original Message-----
> From: rleland@apache.org [mailto:rleland@apache.org]
> Sent: Thursday, March 25, 2004 04:56 AM
> To: jakarta-commons-cvs@apache.org
> Subject: cvs commit: jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript
validateUtilities.js validateByte.js validateCreditCard.js validateDate.js validateEmail.js
validateFloat.js validateFloatRange.js validateIntRange.js validateInteger.js validateMask.js
validateMaxLength.js validateMinLength.js validateRequired.js validateShort.js
> 
> rleland     2004/03/24 20:56:12
> 
>   Modified:    validator/src/javascript/org/apache/commons/validator/javascript
>                         validateByte.js validateCreditCard.js
>                         validateDate.js validateEmail.js validateFloat.js
>                         validateFloatRange.js validateIntRange.js
>                         validateInteger.js validateMask.js
>                         validateMaxLength.js validateMinLength.js
>                         validateRequired.js validateShort.js
>   Added:       validator/src/javascript/org/apache/commons/validator/javascript
>                         validateUtilities.js
>   Log:
>   Bug#: 27899
>   Add function to get an objects attribute if hidden by
>   an html element, in this case the forms name attrubute.
>   Have validator bring in Utility functions.
>   
>   Revision  Changes    Path
>   1.8       +4 -2      jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateByte.js
>   
>   Index: validateByte.js
>   ===================================================================
>   RCS file: /home/cvs/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateByte.js,v
>   retrieving revision 1.7
>   retrieving revision 1.8
>   diff -u -r1.7 -r1.8
>   --- validateByte.js	8 Mar 2004 23:24:25 -0000	1.7
>   +++ validateByte.js	25 Mar 2004 04:56:11 -0000	1.8
>   @@ -11,7 +11,9 @@
>            var focusField = null;
>            var i = 0;
>            var fields = new Array();
>   -        oByte = eval('new ' + form.name + '_ByteValidations()');
>   +        var formName = getAttribute(form,"name");
>   +
>   +        oByte = eval('new ' + formName.value + '_ByteValidations()');
>    
>            for (x in oByte) {
>                var field = form[oByte[x][0]];
>   
>   
>   
>   1.7       +4 -2      jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateCreditCard.js
>   
>   Index: validateCreditCard.js
>   ===================================================================
>   RCS file: /home/cvs/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateCreditCard.js,v
>   retrieving revision 1.6
>   retrieving revision 1.7
>   diff -u -r1.6 -r1.7
>   --- validateCreditCard.js	8 Mar 2004 23:24:25 -0000	1.6
>   +++ validateCreditCard.js	25 Mar 2004 04:56:11 -0000	1.7
>   @@ -11,7 +11,9 @@
>            var focusField = null;
>            var i = 0;
>            var fields = new Array();
>   -        oCreditCard = eval('new ' + form.name + '_creditCard()');
>   +        var formName = getAttribute(form,"name");
>   +
>   +        oCreditCard = eval('new ' + formName.value + '_creditCard()');
>    
>            for (x in oCreditCard) {
>                if ((form[oCreditCard[x][0]].type == 'text' ||
>   
>   
>   
>   1.9       +4 -2      jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateDate.js
>   
>   Index: validateDate.js
>   ===================================================================
>   RCS file: /home/cvs/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateDate.js,v
>   retrieving revision 1.8
>   retrieving revision 1.9
>   diff -u -r1.8 -r1.9
>   --- validateDate.js	8 Mar 2004 23:24:25 -0000	1.8
>   +++ validateDate.js	25 Mar 2004 04:56:11 -0000	1.9
>   @@ -11,7 +11,9 @@
>           var focusField = null;
>           var i = 0;
>           var fields = new Array();
>   -       oDate = eval('new ' + form.name + '_DateValidations()');
>   +       var formName = getAttribute(form,"name");
>   +
>   +       oDate = eval('new ' + formName.value + '_DateValidations()');
>    
>           for (x in oDate) {
>               var field = form[oDate[x][0]];
>   
>   
>   
>   1.8       +4 -2      jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateEmail.js
>   
>   Index: validateEmail.js
>   ===================================================================
>   RCS file: /home/cvs/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateEmail.js,v
>   retrieving revision 1.7
>   retrieving revision 1.8
>   diff -u -r1.7 -r1.8
>   --- validateEmail.js	8 Mar 2004 23:24:25 -0000	1.7
>   +++ validateEmail.js	25 Mar 2004 04:56:11 -0000	1.8
>   @@ -11,7 +11,9 @@
>            var focusField = null;
>            var i = 0;
>            var fields = new Array();
>   -        oEmail = eval('new ' + form.name + '_email()');
>   +        var formName = getAttribute(form,"name");
>   +
>   +        oEmail = eval('new ' + formName.value + '_email()');
>    
>            for (x in oEmail) {
>                var field = form[oEmail[x][0]];
>   
>   
>   
>   1.10      +4 -2      jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateFloat.js
>   
>   Index: validateFloat.js
>   ===================================================================
>   RCS file: /home/cvs/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateFloat.js,v
>   retrieving revision 1.9
>   retrieving revision 1.10
>   diff -u -r1.9 -r1.10
>   --- validateFloat.js	8 Mar 2004 23:24:25 -0000	1.9
>   +++ validateFloat.js	25 Mar 2004 04:56:11 -0000	1.10
>   @@ -11,7 +11,9 @@
>            var focusField = null;
>            var i = 0;
>            var fields = new Array();
>   -        oFloat = eval('new ' + form.name + '_FloatValidations()');
>   +        var formName = getAttribute(form,"name");
>   +
>   +        oFloat = eval('new ' + formName.value + '_FloatValidations()');
>            for (x in oFloat) {
>            	var field = form[oFloat[x][0]];
>            	
>   
>   
>   
>   1.8       +4 -2      jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateFloatRange.js
>   
>   Index: validateFloatRange.js
>   ===================================================================
>   RCS file: /home/cvs/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateFloatRange.js,v
>   retrieving revision 1.7
>   retrieving revision 1.8
>   diff -u -r1.7 -r1.8
>   --- validateFloatRange.js	8 Mar 2004 23:24:25 -0000	1.7
>   +++ validateFloatRange.js	25 Mar 2004 04:56:11 -0000	1.8
>   @@ -11,7 +11,9 @@
>            var focusField = null;
>            var i = 0;
>            var fields = new Array();
>   -        oRange = eval('new ' + form.name + '_floatRange()');
>   +        var formName = getAttribute(form,"name");
>   +
>   +        oRange = eval('new ' + formName.value + '_floatRange()');
>            for (x in oRange) {
>                var field = form[oRange[x][0]];
>                
>   
>   
>   
>   1.9       +4 -2      jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateIntRange.js
>   
>   Index: validateIntRange.js
>   ===================================================================
>   RCS file: /home/cvs/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateIntRange.js,v
>   retrieving revision 1.8
>   retrieving revision 1.9
>   diff -u -r1.8 -r1.9
>   --- validateIntRange.js	8 Mar 2004 23:24:25 -0000	1.8
>   +++ validateIntRange.js	25 Mar 2004 04:56:11 -0000	1.9
>   @@ -11,7 +11,9 @@
>            var focusField = null;
>            var i = 0;
>            var fields = new Array();
>   -        oRange = eval('new ' + form.name + '_intRange()');        
>   +        var formName = getAttribute(form,"name");
>   +
>   +        oRange = eval('new ' + formName.value + '_intRange()');        
>            for (x in oRange) {
>                var field = form[oRange[x][0]];
>                if (field.disabled == false)  {
>   
>   
>   
>   1.8       +4 -2      jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateInteger.js
>   
>   Index: validateInteger.js
>   ===================================================================
>   RCS file: /home/cvs/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateInteger.js,v
>   retrieving revision 1.7
>   retrieving revision 1.8
>   diff -u -r1.7 -r1.8
>   --- validateInteger.js	8 Mar 2004 23:24:25 -0000	1.7
>   +++ validateInteger.js	25 Mar 2004 04:56:11 -0000	1.8
>   @@ -11,7 +11,9 @@
>            var focusField = null;
>            var i = 0;
>            var fields = new Array();
>   -        oInteger = eval('new ' + form.name + '_IntegerValidations()');
>   +        var formName = getAttribute(form,"name");
>   +
>   +        oInteger = eval('new ' + formName.value + '_IntegerValidations()');
>            for (x in oInteger) {
>                var field = form[oInteger[x][0]];
>    
>   
>   
>   
>   1.9       +4 -2      jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateMask.js
>   
>   Index: validateMask.js
>   ===================================================================
>   RCS file: /home/cvs/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateMask.js,v
>   retrieving revision 1.8
>   retrieving revision 1.9
>   diff -u -r1.8 -r1.9
>   --- validateMask.js	8 Mar 2004 23:24:25 -0000	1.8
>   +++ validateMask.js	25 Mar 2004 04:56:11 -0000	1.9
>   @@ -11,7 +11,9 @@
>            var focusField = null;
>            var i = 0;
>            var fields = new Array();
>   -        oMasked = eval('new ' + form.name + '_mask()');      
>   +        var formName = getAttribute(form,"name");
>   +
>   +        oMasked = eval('new ' + formName.value + '_mask()');      
>            for (x in oMasked) {
>                var field = form[oMasked[x][0]];
>    
>   
>   
>   
>   1.9       +4 -2      jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateMaxLength.js
>   
>   Index: validateMaxLength.js
>   ===================================================================
>   RCS file: /home/cvs/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateMaxLength.js,v
>   retrieving revision 1.8
>   retrieving revision 1.9
>   diff -u -r1.8 -r1.9
>   --- validateMaxLength.js	8 Mar 2004 23:24:25 -0000	1.8
>   +++ validateMaxLength.js	25 Mar 2004 04:56:11 -0000	1.9
>   @@ -14,7 +14,9 @@
>            var focusField = null;
>            var i = 0;
>            var fields = new Array();
>   -        oMaxLength = eval('new ' + form.name + '_maxlength()');        
>   +        var formName = getAttribute(form,"name");
>   +
>   +        oMaxLength = eval('new ' + formName.value + '_maxlength()');        
>            for (x in oMaxLength) {
>                var field = form[oMaxLength[x][0]];
>    
>   
>   
>   
>   1.10      +5 -2      jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateMinLength.js
>   
>   Index: validateMinLength.js
>   ===================================================================
>   RCS file: /home/cvs/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateMinLength.js,v
>   retrieving revision 1.9
>   retrieving revision 1.10
>   diff -u -r1.9 -r1.10
>   --- validateMinLength.js	8 Mar 2004 23:24:25 -0000	1.9
>   +++ validateMinLength.js	25 Mar 2004 04:56:11 -0000	1.10
>   @@ -14,7 +14,10 @@
>            var focusField = null;
>            var i = 0;
>            var fields = new Array();
>   -        oMinLength = eval('new ' + form.name + '_minlength()');
>   +        var formName = getAttribute(form,"name");
>   +
>   +
>   +        oMinLength = eval('new ' + formName.value + '_minlength()');
>    
>            for (x in oMinLength) {
>                var field = form[oMinLength[x][0]];
>   
>   
>   
>   1.12      +3 -2      jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateRequired.js
>   
>   Index: validateRequired.js
>   ===================================================================
>   RCS file: /home/cvs/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateRequired.js,v
>   retrieving revision 1.11
>   retrieving revision 1.12
>   diff -u -r1.11 -r1.12
>   --- validateRequired.js	8 Mar 2004 23:24:25 -0000	1.11
>   +++ validateRequired.js	25 Mar 2004 04:56:11 -0000	1.12
>   @@ -12,7 +12,8 @@
>            var focusField = null;
>            var i = 0;
>            var fields = new Array();
>   -        oRequired = eval('new ' + form.name + '_required()');
>   +        var formName = getAttribute(form,"name");
>   +        oRequired = eval('new ' + formName.value + '_required()');
>    
>            for (x in oRequired) {
>                var field = form[oRequired[x][0]];
>   
>   
>   
>   1.8       +4 -2      jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateShort.js
>   
>   Index: validateShort.js
>   ===================================================================
>   RCS file: /home/cvs/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateShort.js,v
>   retrieving revision 1.7
>   retrieving revision 1.8
>   diff -u -r1.7 -r1.8
>   --- validateShort.js	8 Mar 2004 23:24:25 -0000	1.7
>   +++ validateShort.js	25 Mar 2004 04:56:11 -0000	1.8
>   @@ -11,7 +11,9 @@
>            var focusField = null;
>            var i = 0;
>            var fields = new Array();
>   -        oShort = eval('new ' + form.name + '_ShortValidations()');
>   +        var formName = getAttribute(form,"name");
>   +
>   +        oShort = eval('new ' + formName.value + '_ShortValidations()');
>    
>            for (x in oShort) {
>                var field = form[oShort[x][0]];
>   
>   
>   
>   1.1                  jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/validateUtilities.js
>   
>   Index: validateUtilities.js
>   ===================================================================
>       /*$RCSfile: validateUtilities.js,v $ $Revision: 1.1 $ $Date: 2004/03/25 04:56:11
$ */
>       /**
>       * Retrieves an attribute from an object.
>       * This is useful if the attribute is hidden by a htmlElement
>       *
>       * <p>
>       * @param form The form validation is taking place on.
>       */
>       function getAttribute(theObject,attribName) {
>           var attrib = null;
>           for (var attribIndex = 0; (attribIndex < theObject.attributes.length) &&
(attrib == null); attribIndex++) {
>               if (theObject.attributes[attribIndex].name == attribName) {
>                   attrib = theObject.attributes[attribIndex];
>               }
>           }
>           return attrib;
>       }
>           /**
>       * Retrieves an attribute value of an object.
>       * This is useful if the attribute is hidden by an htmlElement
>       *
>       * <p>
>       * @param form The form validation is taking place on.
>       */
>       function getAttributeValue(theObject,attribName) {
>   
>           return getAttribute(theObject,attribName).value;
>       }
>   
>   
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 
> 



---------------------------------------------------------------------
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