You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2005/11/22 20:06:48 UTC

DO NOT REPLY [Bug 37594] - Collision between Prototype.js and Validator

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=37594>.
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=37594





------- Additional Comments From p.mouawad@ubik-ingenierie.com  2005-11-22 20:06 -------
Created an attachment (id=17013)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=17013&action=view)
Patch to version 1.1.4 containing correction to JS files

The issue is in the JS files of the library.
Here are the correction made on the Javascript files:

Scope too large for your variables:
*	 oCreditCard, oByte,oDate
*	 Replaced == true by === true, same for == 0
*	 parse(x) replaced by parse(x, 10)

I'am using prototype.js in conjunction with the validator but I am facing the
following problem,
this library adds a field extends to objects so for (var x in oRequired) will
iterate over 4 fields instead of 3
and encounter x = 'extends' and oRequired[x][0] will be undefined breaking the
rest.

What I did was to add matchValidationVariable () function with the following
code that checks that the variable
oRequired[x][0]  is not undefined and that the name of x matches your variable
names ('^a[0-9]*$'):
  function matchValidationVariable(variable, value)
  {
		  var theRegexp = new RegExp('^a[0-9]*$');
		  return ((typeof value[0] !== undefined) &&
			  (theRegexp.exec(variable) !== null));
  }


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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