commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 27899] - Javascript validation doesn't work if a form field is called "name"
Date Thu, 25 Mar 2004 03:41:18 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27899>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=27899

Javascript validation doesn't work if a form field is called "name"





------- Additional Comments From rleland@apache.org  2004-03-25 03:41 -------
This following snippet will fix the bug,I tested it on IE & Mozilla, 

Instead of:
   oRequired = eval('new ' + form.name + '_required()');
Use:
   var formName = null;
   for (var attribIndex = 0; (attribIndex < form.attributes.length) &&  
(formName == null); attribIndex++) {
           if (form.attributes[attribIndex].name == "name") {
                formName = form.attributes[attribIndex].value;
         }
    }
oRequired = eval('new ' + formName + '_required()');

However, it points out a weakness in Validators handling of javaScript in that
the snippet of code needs to be in a callable function. I could stick it in
one of the .js files like validateRequired.js but we need a better solution.

I am crunched at work until Mid April, and if someone wants to just srick this 
snippet in one of the .js files as a function thats ok by me.

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