commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r330237 - in /jakarta/commons/proper/validator/trunk: src/javascript/org/apache/commons/validator/javascript/validateUtilities.js xdocs/changes.xml
Date Wed, 02 Nov 2005 11:48:24 GMT
Author: niallp
Date: Wed Nov  2 03:48:08 2005
New Revision: 330237

URL: http://svn.apache.org/viewcvs?rev=330237&view=rev
Log:
Fix for Bug 37315 Javascript Validation currently uses unsupported DOM method getAttributeNode()
reported by Jeffrey Williams

Modified:
    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/validateUtilities.js
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/javascript/org/apache/commons/validator/javascript/validateUtilities.js?rev=330237&r1=330236&r2=330237&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
Wed Nov  2 03:48:08 2005
@@ -10,9 +10,28 @@
    * @param form The form validation is taking place on.
    */
   function retrieveFormName(form) {
-      // if id is available, then use it (for xhtml)
-      // otherwise, use the value of the name attribute
-      var formName = form.id ? form.id :
-          form.getAttributeNode("name").value;
-      return formName;
+
+      // Please refer to Bugs 31534, 35127, 35294 & 37315
+      // for the history of the following code
+
+      if (form.getAttributeNode) {
+          if (form.getAttributeNode("id") && form.getAttributeNode("id").value) {
+              return form.getAttributeNode("id").value;
+          } else {
+              return form.getAttributeNode("name").value;
+          }
+      } else if (form.getAttribute) {
+          if (form.getAttribute("id")) {
+              return form.getAttribute("id");
+          } else {
+              form.attributes["name"];
+          }
+      } else {
+          if (form.id) {
+              return form.id;
+          } else {
+              return form.name;
+          }
+      }
+
   }  

Modified: jakarta/commons/proper/validator/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/xdocs/changes.xml?rev=330237&r1=330236&r2=330237&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/xdocs/changes.xml (original)
+++ jakarta/commons/proper/validator/trunk/xdocs/changes.xml Wed Nov  2 03:48:08 2005
@@ -176,6 +176,10 @@
          Int validation in Java and Javascript have different semantics.
         <a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=37300">PR# 37300</a>
       </action>
+      <action dev="niallp" type="fix">
+         Javascript Validation currently uses unsupported DOM method getAttributeNode().
+        <a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=37315">PR# 37315</a>
+      </action>
     </release>
   
     <release version="1.1.4" date="2004-11-12">



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