diff options
author | wei <> | 2006-01-16 03:55:06 +0000 |
---|---|---|
committer | wei <> | 2006-01-16 03:55:06 +0000 |
commit | 5e979d01cd8eaa755f15b59f1d5cfa8f88686244 (patch) | |
tree | 04c359088bcfea7203cd5dcf6cf86e794d04977c /framework/Web/Javascripts/prado | |
parent | 4cecd6f96c26f747181639046c983ead66f28f17 (diff) |
Diffstat (limited to 'framework/Web/Javascripts/prado')
-rw-r--r-- | framework/Web/Javascripts/prado/validation.js | 6 | ||||
-rw-r--r-- | framework/Web/Javascripts/prado/validators.js | 18 |
2 files changed, 10 insertions, 14 deletions
diff --git a/framework/Web/Javascripts/prado/validation.js b/framework/Web/Javascripts/prado/validation.js index 33d5411d..8b796cb1 100644 --- a/framework/Web/Javascripts/prado/validation.js +++ b/framework/Web/Javascripts/prado/validation.js @@ -150,10 +150,10 @@ Prado.Validation.Util.toDate = function(value, format) * @param {string} string to be trimmed.
* @type {string} trimmed string.
*/
-Prado.Validation.Util.trim = function(value)
+Prado.Validation.trim = function(value)
{
- if(undef(value)) return "";
- return value.replace(/^\s+|\s+$/g, "");
+ if(isString(value)) return value.trim();
+ return "";
}
/**
diff --git a/framework/Web/Javascripts/prado/validators.js b/framework/Web/Javascripts/prado/validators.js index 427b46fc..e1860563 100644 --- a/framework/Web/Javascripts/prado/validators.js +++ b/framework/Web/Javascripts/prado/validators.js @@ -5,18 +5,16 @@ Prado.Validation.TRequiredFieldValidator=function(){ return true;
}
else{
- var trim=Prado.Util.trim;
- var a=trim(Form.Element.getValue(this.control));
- var b=trim(this.attr.initialvalue);
- return(a!=b);
+ var a= Prado.Validation.trim($F(this.control));
+ var b= Prado.Validation.trim(this.attr.initialvalue);
+ return(a != b);
}
}
Prado.Validation.TRegularExpressionValidator = function()
{
- var trim = Prado.Util.trim;
- var value = trim(Form.Element.getValue(this.control));
+ var value = Prado.Validation.trim($F(this.control));
if (value == "") return true;
var rx = new RegExp(this.attr.validationexpression);
var matches = rx.exec(value);
@@ -35,8 +33,7 @@ Prado.Validation.TCustomValidator = function() Prado.Validation.TRangeValidator = function()
{
- var trim = Prado.Util.trim;
- var value = trim(Form.Element.getValue(this.control));
+ var value = Prado.Validation.trim($F(this.control));
if (value == "") return true;
var minval = this.attr.minimumvalue;
@@ -62,8 +59,7 @@ Prado.Validation.TRangeValidator = function() Prado.Validation.TCompareValidator = function()
{
- var trim = Prado.Util.trim;
- var value = trim(Form.Element.getValue(this.control));
+ var value = Prado.Validation.trim($F(this.control));
if (value.length == 0) return true;
var compareTo;
@@ -71,7 +67,7 @@ Prado.Validation.TCompareValidator = function() var comparee = $(this.attr.controlhookup);;
if(comparee)
- compareTo = trim(Form.Element.getValue(comparee));
+ compareTo = Prado.Validation.trim($F(comparee));
else
{
compareTo = isString(this.attr.valuetocompare) ? this.attr.valuetocompare : "";
|