summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls
diff options
context:
space:
mode:
authorwei <>2006-05-27 04:29:26 +0000
committerwei <>2006-05-27 04:29:26 +0000
commitf4169ef12e83b93d9693c3e9278af6a6f02861d6 (patch)
treefd9c1074d5e9ee452d1cd8c2f3893849e3ea0003 /framework/Web/UI/WebControls
parentf21a3840e2486a298ec6976771888f02e3748ebb (diff)
Fixed #169.
Diffstat (limited to 'framework/Web/UI/WebControls')
-rw-r--r--framework/Web/UI/WebControls/TBaseValidator.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php
index 8fcba1c2..9ff2a97d 100644
--- a/framework/Web/UI/WebControls/TBaseValidator.php
+++ b/framework/Web/UI/WebControls/TBaseValidator.php
@@ -83,6 +83,12 @@ abstract class TBaseValidator extends TLabel implements IValidator
* @var TValidatorClientScript validator client-script options.
*/
private $_clientScript;
+ /**
+ * Controls for which the client-side validation3.js file needs to handle
+ * them specially.
+ * @var array list of control class names
+ */
+ private static $_clientClass = array('THtmlArea', 'TDatePicker');
/**
* Constructor.
@@ -152,7 +158,8 @@ abstract class TBaseValidator extends TLabel implements IValidator
$options['ValidationGroup'] = $this->getValidationGroup();
$options['ControlToValidate'] = $control->getClientID();
$options['ControlCssClass'] = $this->getControlCssClass();
- $options['ControlType'] = get_class($control);
+
+ $options['ControlType'] = $this->getClientControlClass($control);
if(!is_null($this->_clientScript))
$options = array_merge($options,$this->_clientScript->getOptions());
@@ -161,6 +168,21 @@ abstract class TBaseValidator extends TLabel implements IValidator
}
/**
+ * Gets the Control type for client-side validation. If new cases exists in
+ * TBaseValidator::$_clientClass, be sure to update the corresponding
+ * "Javascript/validation3.js" file as well.
+ * @param TControl control to validate.
+ * @return string control type for client-side validation.
+ */
+ private function getClientControlClass($control)
+ {
+ foreach(self::$_clientClass as $type)
+ if($control instanceof $type)
+ return $type;
+ return get_class($control);
+ }
+
+ /**
* Gets the TValidatorClientScript that allows modification of the client-
* side validator events.
*