summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TPanel.php
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/UI/WebControls/TPanel.php')
-rw-r--r--framework/Web/UI/WebControls/TPanel.php30
1 files changed, 20 insertions, 10 deletions
diff --git a/framework/Web/UI/WebControls/TPanel.php b/framework/Web/UI/WebControls/TPanel.php
index cf21eeef..227a9a3e 100644
--- a/framework/Web/UI/WebControls/TPanel.php
+++ b/framework/Web/UI/WebControls/TPanel.php
@@ -4,7 +4,7 @@
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2011 PradoSoft
+ * @copyright Copyright &copy; 2005-2011 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web.UI.WebControls
@@ -73,15 +73,7 @@ class TPanel extends TWebControl
{
parent::addAttributesToRender($writer);
if(($butt=$this->getDefaultButton())!=='')
- {
- if(($button=$this->findControl($butt))===null)
- throw new TInvalidDataValueException('panel_defaultbutton_invalid',$butt);
- else
- {
- $writer->addAttribute('id',$this->getClientID());
- $this->getPage()->getClientScript()->registerDefaultButton($this, $button);
- }
- }
+ $writer->addAttribute('id',$this->getClientID());
}
/**
@@ -232,5 +224,23 @@ class TPanel extends TWebControl
$writer->renderEndTag();
parent::renderEndTag($writer);
}
+
+ public function render($writer)
+ {
+ parent::render($writer);
+
+ if(($butt=$this->getDefaultButton())!=='')
+ {
+ $buttons = $this->findControlsByID($butt);
+ if (count($buttons)>0)
+ $button = reset($buttons);
+ else
+ $buttons = null;
+ if($button===null)
+ throw new TInvalidDataValueException('panel_defaultbutton_invalid',$butt);
+ else
+ $this->getPage()->getClientScript()->registerDefaultButton($this, $button);
+ }
+ }
}