From 270282e3a26b21184a2051995cb5b9a2755b823d Mon Sep 17 00:00:00 2001 From: wei <> Date: Sat, 18 Feb 2006 23:41:16 +0000 Subject: Update some javascript code. --- .../Web/UI/WebControls/TValidationSummary.php | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'framework/Web/UI/WebControls/TValidationSummary.php') diff --git a/framework/Web/UI/WebControls/TValidationSummary.php b/framework/Web/UI/WebControls/TValidationSummary.php index e7115c99..61a4415c 100644 --- a/framework/Web/UI/WebControls/TValidationSummary.php +++ b/framework/Web/UI/WebControls/TValidationSummary.php @@ -36,6 +36,25 @@ */ class TValidationSummary extends TWebControl { + /** + * @return string the display behavior (None, Static, Dynamic) of the error message in a validation summary component. + */ + public function getDisplay() + { + return $this->getViewState('Display','Static'); + } + + /** + * Sets the display behavior (None, Static, Dynamic) of the error message in a validation summary component. + * @param string the display behavior (None, Static, Dynamic) + */ + public function setDisplay($value) + { + if($value!='None' && $value!='Dynamic') + $value='Static'; + $this->setViewState('Display',$value,'Static'); + } + /** * @return string the header text displayed at the top of the summary */ @@ -170,6 +189,15 @@ class TValidationSummary extends TWebControl protected function addAttributesToRender($writer) { + $display=$this->getDisplay(); + $visible=$this->getEnabled(true) && count($this->getErrorMessages()) > 0; + if(!$visible) + { + if($display==='None' || $display==='Dynamic') + $writer->addStyleAttribute('display','none'); + else + $writer->addStyleAttribute('visibility','hidden'); + } $writer->addAttribute('id',$this->getClientID()); parent::addAttributesToRender($writer); } @@ -205,6 +233,7 @@ class TValidationSummary extends TWebControl $options['refresh'] = $this->getAutoUpdate(); $options['validationgroup'] = $this->getValidationGroup(); + $options['display'] = $this->getDisplay(); return $options; } -- cgit v1.2.3