From 47be9e10cfa0aae464a8e9789db9b438378a6099 Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 9 Jan 2006 01:56:12 +0000 Subject: --- framework/Web/UI/WebControls/TBaseValidator.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'framework/Web/UI/WebControls/TBaseValidator.php') diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php index 6326783a..f8bfc28b 100644 --- a/framework/Web/UI/WebControls/TBaseValidator.php +++ b/framework/Web/UI/WebControls/TBaseValidator.php @@ -111,6 +111,14 @@ abstract class TBaseValidator extends TLabel implements IValidator */ protected function addAttributesToRender($writer) { + $display=$this->getDisplay(); + $visible=$this->getEnabled(true) && !$this->getIsValid(); + if($display==='None' || (!$visible && $display==='Dynamic')) + $writer->addStyleAttribute('display','none'); + else if(!$visible) + $writer->addStyleAttribute('visibility','hidden'); + $writer->addAttribute('id',$this->getClientID()); + parent::addAttributesToRender($writer); } /** @@ -125,7 +133,7 @@ abstract class TBaseValidator extends TLabel implements IValidator $options['FocusOnError'] = $this->getFocusOnError(); $options['FocusElementID'] = $this->getFocusElementID(); $options['ValidationGroup'] = $this->getValidationGroup(); - $options['ControlToValidate'] = $this->getControlToValidate(); + $options['ControlToValidate'] = $this->getValidationTarget()->getClientID(); return $options; } @@ -144,6 +152,7 @@ abstract class TBaseValidator extends TLabel implements IValidator $scripts->registerPradoScript('validator'); $js = "Prado.Validation.AddForm('{$this->Page->Form->ClientID}');"; $scripts->registerEndScript($scriptKey, $js); + $this->renderClientScriptValidator(); } parent::onPreRender($param); } @@ -335,10 +344,10 @@ abstract class TBaseValidator extends TLabel implements IValidator { if($control instanceof IValidatable) { - $value=$control->getValidationValue(); - if($value instanceof TListItem) - return $value->getValue(); - else + $value=$control->getValidationPropertyValue(); + //if($value instanceof TListItem) + // return $value->getValue(); + //else return TPropertyValue::ensureString($value); } else -- cgit v1.2.3