From 5d88ad05e5956071d5904662d133625f157ce230 Mon Sep 17 00:00:00 2001 From: xue <> Date: Thu, 19 Jan 2006 02:54:27 +0000 Subject: Added documentation to validator controls. --- framework/Web/UI/WebControls/TCompareValidator.php | 45 ++++++++++++---------- 1 file changed, 24 insertions(+), 21 deletions(-) (limited to 'framework/Web/UI/WebControls/TCompareValidator.php') diff --git a/framework/Web/UI/WebControls/TCompareValidator.php b/framework/Web/UI/WebControls/TCompareValidator.php index cfc2e876..02eddfd4 100644 --- a/framework/Web/UI/WebControls/TCompareValidator.php +++ b/framework/Web/UI/WebControls/TCompareValidator.php @@ -18,31 +18,32 @@ Prado::using('System.Web.UI.WebControls.TBaseValidator'); /** * TCompareValidator class * - * TCompareValidator compares the value entered by the user into an input component with the value - * entered into another input component or a constant value. To specify the input component to - * validate, set the ControlToValidate property to the ID of the input component. + * TCompareValidator compares the value entered by the user into an input + * control with the value entered into another input control or a constant value. + * To compare the associated input control with another input control, + * set the {@link setControlToCompare ControlToCompare} property to the ID path + * of the control to compare with. To compare the associated input control with + * a constant value, specify the constant value to compare with by setting the + * {@link setValueToCompare ValueToCompare} property. * - * To compare the associated input component with another input component, - * set the ControlToCompare property to the ID of the component to compare with. - * - * To compare the associated input component with a constant value, - * specify the constant value to compare with by setting the ValueToCompare property. - * - * The ValueType property is used to specify the data type of both comparison values. - * Both values are automatically converted to this data type before the comparison operation - * is performed. The following value types are supported: + * The {@link setValueType ValueType} property is used to specify the data type + * of both comparison values. Both values are automatically converted to this data + * type before the comparison operation is performed. The following value types are supported: * - Integer A 32-bit signed integer data type. * - Double A double-precision floating point number data type. * - Currency A decimal data type that can contain currency symbols. * - Date A date data type. The format follows the GNU date syntax. * - String A string data type. * - * Use the Operator property to specify the type of comparison to perform, - * such as Equal, NotEqual, GreaterThan, GreaterThanEqual, LessThan, LessThanEqual, DataTypeCheck. - * If you set the Operator property to DataTypeCheck, the TCompareValidator component - * will ignore the ControlToCompare and ValueToCompare properties and simply - * indicates whether the value entered into the input component can be converted to the data type - * specified by the ValueType property. + * Use the {@link setOperator Operator} property to specify the type of comparison + * to perform. Valid operators include Equal, NotEqual, GreaterThan, GreaterThanEqual, + * LessThan, LessThanEqual, and DataTypeCheck. + * + * Note, if you set {@link setOperator Operator} to DataTypeCheck, the validator + * will ignore the {@link setControlToCompare ControlToCompare} and + * {@link setValueToCompare ValueToCompare} properties and simply + * indicates whether the value entered into the input control can be converted + * to the data type specified by the {@link setValueType ValueType} property. * * @author Qiang Xue * @version $Revision: $ $Date: $ @@ -145,9 +146,7 @@ class TCompareValidator extends TBaseValidator */ public function evaluateIsValid() { - if(($control=$this->getValidationTarget())===null) - throw new TInvalidDataValueException('comparevalidator_controltovalidate_invalid'); - if(($value=$this->getValidationValue($control))==='') + if(($value=$this->getValidationValue($this->getValidationTarget()))==='') return true; if($this->getOperator()==='DataTypeCheck') @@ -245,6 +244,10 @@ class TCompareValidator extends TBaseValidator return array($value1, $value2); } + /** + * Returns an array of javascript validator options. + * @return array javascript validator options. + */ protected function getClientScriptOptions() { $options = parent::getClientScriptOptions(); -- cgit v1.2.3