diff options
author | xue <> | 2005-12-13 15:14:38 +0000 |
---|---|---|
committer | xue <> | 2005-12-13 15:14:38 +0000 |
commit | 1ed5d8c3f241116df31b92031ae18a2e6b5b3d4c (patch) | |
tree | a1a6b303f83294e17c4c20fb2e2b483a4e3d3d22 /framework/Web/UI/WebControls/TButton.php | |
parent | 597dcf809dac8ba80bf754dc5e02f8b7ff370c8b (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/TButton.php')
-rw-r--r-- | framework/Web/UI/WebControls/TButton.php | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/framework/Web/UI/WebControls/TButton.php b/framework/Web/UI/WebControls/TButton.php index 3a92d809..735c3b50 100644 --- a/framework/Web/UI/WebControls/TButton.php +++ b/framework/Web/UI/WebControls/TButton.php @@ -74,19 +74,6 @@ class TButton extends TWebControl implements IPostBackEventHandler if(($uniqueID=$this->getUniqueID())!=='')
$writer->addAttribute('name',$uniqueID);
$writer->addAttribute('value',$this->getText());
- if(!$this->getEnabled(true) && $this->getEnabled()) // in this case, parent will not render 'disabled'
- $writer->addAttribute('disabled','disabled');
- parent::addAttributesToRender($writer);
- }
-
- /**
- * Registers the postback javascript code.
- * If you override this method, be sure to call the parent implementation
- * so that the event handlers can be invoked.
- * @param TEventParameter event parameter to be passed to the event handlers
- */
- protected function onPreRender($param)
- {
if($this->getEnabled(true))
{
$scripts = $this->getPage()->getClientScript();
@@ -94,7 +81,9 @@ class TButton extends TWebControl implements IPostBackEventHandler $postback = $scripts->getPostBackEventReference($this, '', $options, false);
$scripts->registerClientEvent($this, "click", $postback);
}
- parent::onPreRender($param);
+ else if($this->getEnabled()) // in this case, parent will not render 'disabled'
+ $writer->addAttribute('disabled','disabled');
+ parent::addAttributesToRender($writer);
}
/**
@@ -115,7 +104,7 @@ class TButton extends TWebControl implements IPostBackEventHandler if($this->getPostBackUrl()!=='')
$option->setActionUrl($this->getPostBackUrl());
$option->setClientSubmit(!$this->getUseSubmitBehavior());
-
+
return $option;
}
|