From 922e2cc3cb7f9b79dfb8857903522bd14fadf6e5 Mon Sep 17 00:00:00 2001 From: tof <> Date: Fri, 22 Feb 2008 17:53:43 +0000 Subject: Fixed Ticket#747 - TRangeValidator accept letters when type Integer is specified. --- framework/Web/UI/WebControls/TRangeValidator.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'framework/Web/UI/WebControls/TRangeValidator.php') diff --git a/framework/Web/UI/WebControls/TRangeValidator.php b/framework/Web/UI/WebControls/TRangeValidator.php index 36dbcdca..13f5465c 100644 --- a/framework/Web/UI/WebControls/TRangeValidator.php +++ b/framework/Web/UI/WebControls/TRangeValidator.php @@ -200,8 +200,8 @@ class TRangeValidator extends TBaseValidator $minValue=$this->getMinValue(); $maxValue=$this->getMaxValue(); + $valid=preg_match('/^[-+]?[0-9]+$/',trim($value)); $value=intval($value); - $valid=true; if($minValue!=='') $valid=$valid && $this->isGreaterThan($value, intval($minValue)); if($maxValue!=='') @@ -228,9 +228,9 @@ class TRangeValidator extends TBaseValidator { $minValue=$this->getMinValue(); $maxValue=$this->getMaxValue(); - + + $valid=preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/',trim($value)); $value=floatval($value); - $valid=true; if($minValue!=='') $valid=$valid && $this->isGreaterThan($value,floatval($minValue)); if($maxValue!=='') -- cgit v1.2.3