summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TCheckBox.php
diff options
context:
space:
mode:
authorxue <>2005-12-13 15:14:38 +0000
committerxue <>2005-12-13 15:14:38 +0000
commit1ed5d8c3f241116df31b92031ae18a2e6b5b3d4c (patch)
treea1a6b303f83294e17c4c20fb2e2b483a4e3d3d22 /framework/Web/UI/WebControls/TCheckBox.php
parent597dcf809dac8ba80bf754dc5e02f8b7ff370c8b (diff)
Moved code for registering postback js from onPreRender to addAttributesToRender. It's too early to register js in onPreRender.
Diffstat (limited to 'framework/Web/UI/WebControls/TCheckBox.php')
-rw-r--r--framework/Web/UI/WebControls/TCheckBox.php31
1 files changed, 12 insertions, 19 deletions
diff --git a/framework/Web/UI/WebControls/TCheckBox.php b/framework/Web/UI/WebControls/TCheckBox.php
index ba3a45f7..2f51d8f5 100644
--- a/framework/Web/UI/WebControls/TCheckBox.php
+++ b/framework/Web/UI/WebControls/TCheckBox.php
@@ -51,13 +51,6 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl
}
/**
- */
- protected function addAttributesToRender($writer)
- {
- // TODO: add display inline block
- }
-
- /**
* Loads user input data.
* This method is primarly used by framework developers.
* @param string the key that can be used to retrieve data from the input data collection
@@ -108,9 +101,9 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl
* Registers the checkbox to receive postback data during postback.
* This is necessary because a checkbox if unchecked, when postback,
* does not have direct mapping between post data and the checkbox name.
- *
+ *
* Auto-postback javascript code is also registered here.
- *
+ *
* This method overrides the parent implementation and is invoked before render.
* @param mixed event parameter
*/
@@ -119,15 +112,6 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl
parent::onPreRender($param);
if($this->getEnabled(true))
$this->getPage()->registerRequiresPostData($this);
-
- if($this->getAutoPostBack()
- && $this->getPage()->getClientSupportsJavaScript())
- {
- $options = $this->getAutoPostBackOptions();
- $scripts = $this->getPage()->getClientScript();
- $postback = $scripts->getPostBackEventReference($this,'',$options,false);
- $scripts->registerClientEvent($this, "click", $postback);
- }
}
/**
@@ -364,7 +348,16 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl
$writer->addAttribute('checked','checked');
if(!$this->getEnabled(true))
$writer->addAttribute('disabled','disabled');
+
$page=$this->getPage();
+ if($this->getAutoPostBack() && $page->getClientSupportsJavaScript())
+ {
+ $options = $this->getAutoPostBackOptions();
+ $scripts = $page->getClientScript();
+ $postback = $scripts->getPostBackEventReference($this,'',$options,false);
+ $scripts->registerClientEvent($this, "click", $postback);
+ }
+
if(($accesskey=$this->getAccessKey())!=='')
$writer->addAttribute('accesskey',$accesskey);
if(($tabindex=$this->getTabIndex())>0)
@@ -377,7 +370,7 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl
/**
* Sets the post back options for this textbox.
- * @return TPostBackOptions
+ * @return TPostBackOptions
*/
protected function getAutoPostBackOptions()
{