summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Klaer <kj.landwehr.software@gmail.com>2015-09-15 11:32:34 +0200
committerJens Klaer <kj.landwehr.software@gmail.com>2015-09-15 11:32:34 +0200
commitf920798fd13d0d76b12da1f2862e52cf7bbff6e1 (patch)
tree4b14782f8d25f1d1c8ed9be4e81ab546b3615a61
parentbfeada5a44e8efc51cf58860170524f64e658bb3 (diff)
small fixes for clientside validation
-rw-r--r--framework/Web/Javascripts/source/prado/validator/validation3.js44
1 files changed, 25 insertions, 19 deletions
diff --git a/framework/Web/Javascripts/source/prado/validator/validation3.js b/framework/Web/Javascripts/source/prado/validator/validation3.js
index bdf0f592..24466599 100644
--- a/framework/Web/Javascripts/source/prado/validator/validation3.js
+++ b/framework/Web/Javascripts/source/prado/validator/validation3.js
@@ -439,9 +439,9 @@ Prado.ValidationManager.prototype =
*/
isValid : function(group)
{
- for(var i = 0; i < this.validatorPartition(group)[0]; i++)
+ for(var i = 0; i < this.validatorPartition(group)[0].length; i++)
{
- if(!this.validatorPartition(group)[0].isValid())
+ if(!this.validatorPartition(group)[0][i].isValid)
return false;
}
@@ -456,16 +456,16 @@ Prado.ValidationManager.prototype =
addValidator : function(validator)
{
// Remove previously registered validator with same ID
- // to prevent stale validators created by AJAX updates
- this.removeValidator(validator);
+ // to prevent stale validators created by AJAX updates
+ this.removeValidator(validator);
this.validators.push(validator);
if(validator.group && jQuery.inArray(validator.group, this.groups)==-1)
this.groups.push(validator.group);
- if (typeof this.controls[validator.control.id] === 'undefined')
- this.controls[validator.control.id] = Array();
- this.controls[validator.control.id].push(validator);
+ if(typeof this.controls[validator.control.id] === 'undefined')
+ this.controls[validator.control.id] = Array();
+ this.controls[validator.control.id].push(validator);
},
/**
@@ -483,19 +483,25 @@ Prado.ValidationManager.prototype =
* @function ?
* @param {TBaseValidator} validator - Validator object
*/
- removeValidator : function(validator)
+ removeValidator : function(validator)
+ {
+ // Remove from list of validators
+ this.validators = jQuery.grep(this.validators, function(v)
+ {
+ return (v.options.ID!=validator.options.ID);
+ });
+ // Remove from global list of validators per control
+ if (this.controls[validator.control.id])
{
- this.validators = jQuery.grep(this.validators, function(v)
- {
- return (v.options.ID!=validator.options.ID);
- });
- // WTF?
- if (this.controls[validator.control.id])
- jQuery.grep(this.controls[validator.control.id], function(v)
- {
- return (v.options.ID!=validator.options.ID)
- });
- },
+ this.controls[validator.control.id] = jQuery.grep(this.controls[validator.control.id], function(v)
+ {
+ return (v.options.ID!=validator.options.ID)
+ });
+ // Delete array if empty
+ if(this.controls[validator.control.id].length == 0)
+ delete this.controls[validator.control.id];
+ }
+ },
/**
* Gets validators with errors.