You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by aw...@apache.org on 2007/08/25 03:49:37 UTC
svn commit: r569597 -
/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
Author: awiner
Date: Fri Aug 24 18:49:36 2007
New Revision: 569597
URL: http://svn.apache.org/viewvc?rev=569597&view=rev
Log:
Add a bit of defensive coding to JS validation code; no repro'd bug,
but a user report of one
Modified:
myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js?rev=569597&r1=569596&r2=569597&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js Fri Aug 24 18:49:36 2007
@@ -2279,28 +2279,31 @@
if ( converterError == false)
{
var validatorArray = descriptor.validators;
- for ( var j = 0; j < validatorArray.length; j = j + 1)
+ if (validatorArray)
{
- // do the validation if this element has a value
- // Don't just compare against "", since the value has
- // already been converted to a non-string type
- if ((value !== null) &&
- !((typeof value == "string") && value == ""))
+ for ( var j = 0; j < validatorArray.length; j = j + 1)
{
- // evaluate the validator
- var validatorConstructor = validatorArray[j];
- if (validatorConstructor && value !== undefined)
+ // do the validation if this element has a value
+ // Don't just compare against "", since the value has
+ // already been converted to a non-string type
+ if ((value !== null) &&
+ !((typeof value == "string") && value == ""))
{
- var validator = eval(validatorConstructor);
-
- try
+ // evaluate the validator
+ var validatorConstructor = validatorArray[j];
+ if (validatorConstructor && value !== undefined)
{
- validator.validate(value, label, converter);
- }
- catch (e)
- {
- // Populate the failureMap with the current error
- inputFailures[inputFailures.length] = e.getFacesMessage();
+ var validator = eval(validatorConstructor);
+
+ try
+ {
+ validator.validate(value, label, converter);
+ }
+ catch (e)
+ {
+ // Populate the failureMap with the current error
+ inputFailures[inputFailures.length] = e.getFacesMessage();
+ }
}
}
}