commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mr...@apache.org
Subject svn commit: r191324 - /jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateRequired.js
Date Sun, 19 Jun 2005 07:26:46 GMT
Author: mrdon
Date: Sun Jun 19 00:26:45 2005
New Revision: 191324

URL: http://svn.apache.org/viewcvs?rev=191324&view=rev
Log:
Adding checks to ensure validator will fail if field isn't present in
form. 

PR: 15912

Modified:
    jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateRequired.js

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=191324&r1=191323&r2=191324&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 Jun 19 00:26:45 2005
@@ -22,7 +22,10 @@
         for (x in oRequired) {
             var field = form[oRequired[x][0]];
 
-            if ((field.type == 'hidden' ||
+            if (field == null) {
+                fields[i++] = oRequired[x][1];
+                isValid=false;
+            } else if ((field.type == 'hidden' ||
                 field.type == 'text' ||
                 field.type == 'textarea' ||
                 field.type == 'file' ||
@@ -86,10 +89,12 @@
                     fields[i++] = oRequired[x][1];
                     isValid=false;
                 }
-            }
+            }   
         }
         if (fields.length > 0) {
-           focusField.focus();
+           if (focusField != null) {
+               focusField.focus();
+           }     
            alert(fields.join('\n'));
         }
         return isValid;



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