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/TCustomValidator.php | 46 +++++++++++++---------- 1 file changed, 27 insertions(+), 19 deletions(-) (limited to 'framework/Web/UI/WebControls/TCustomValidator.php') diff --git a/framework/Web/UI/WebControls/TCustomValidator.php b/framework/Web/UI/WebControls/TCustomValidator.php index 8c42b580..546f015b 100644 --- a/framework/Web/UI/WebControls/TCustomValidator.php +++ b/framework/Web/UI/WebControls/TCustomValidator.php @@ -22,11 +22,12 @@ Prado::using('System.Web.UI.WebControls.TBaseValidator'); * server-side or client-side or both) on an input component. * * To create a server-side validation function, provide a handler for - * the OnServerValidate event that performs the validation. - * The data string of the input component to validate can be accessed - * by the value property of the event parameter which is of type - * TServerValidateEventParameter. The result of the validation - * should be stored in the isValid property of the event parameter. + * the {@link onServerValidate ServerValidate} event that performs the validation. + * The data string of the input control to validate can be accessed + * by {@link TServerValidateEventParameter::getValue Value} of the event parameter. + * The result of the validation should be stored in the + * {@link TServerValidateEventParameter::getIsValid IsValid} property of the event + * parameter. * * To create a client-side validation function, add the client-side * validation javascript function to the page template. @@ -42,8 +43,9 @@ Prado::using('System.Web.UI.WebControls.TBaseValidator'); * } * --> * - * Use the ClientValidationFunction property to specify the name of - * the client-side validation script function associated with the TCustomValidator. + * Use the {@link setClientValidationFunction ClientValidationFunction} property + * to specify the name of the client-side validation script function associated + * with the TCustomValidator. * * @author Qiang Xue * @version $Revision: $ $Date: $ @@ -76,24 +78,16 @@ class TCustomValidator extends TBaseValidator */ public function evaluateIsValid() { - if(($id=$this->getControlToValidate())!=='') - { - if(($control=$this->findControl($id))!==null) - $value=$this->getValidationValue($control); - else - throw new TInvalidDataValueException('customvalidator_controltovalidate_invalid'); - return $this->onServerValidate($value); - } - else - throw new TInvalidDataValueException('customvalidator_controltovalidate_required'); + $value=$this->getValidationValue($this->getValidationTarget()); + return $this->onServerValidate($value); } /** * This method is invoked when the server side validation happens. - * It will raise the OnServerValidate event. + * It will raise the ServerValidate event. * The method also allows derived classes to handle the event without attaching a delegate. * Note The derived classes should call parent implementation - * to ensure the OnServerValidate event is raised. + * to ensure the ServerValidate event is raised. * @param string the value to be validated * @return boolean whether the value is valid */ @@ -142,22 +136,36 @@ class TServerValidateEventParameter extends TEventParameter */ private $_isValid=true; + /** + * Constructor. + * @param string property value to be validated + * @param boolean whether the value is valid + */ public function __construct($value,$isValid) { $this->_value=$value; $this->setIsValid($isValid); } + /** + * @return string value to be validated + */ public function getValue() { return $this->_value; } + /** + * @return boolean whether the value is valid + */ public function getIsValid() { return $this->_isValid; } + /** + * @param boolean whether the value is valid + */ public function setIsValid($value) { $this->_isValid=TPropertyValue::ensureBoolean($value); -- cgit v1.2.3