summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwei <>2007-04-01 07:00:25 +0000
committerwei <>2007-04-01 07:00:25 +0000
commitacbeaa0255f86bf88f35a1192ec05bfc0d5ac92b (patch)
tree5db66bc4cc9d11720bdcb6af2728db6520b90117
parent345f4c1e149d7c84e9d10831971e2a9061246d72 (diff)
Fix default button not firing in IE if no validator is assigned to the button
-rw-r--r--framework/Web/UI/WebControls/TButton.php6
-rw-r--r--framework/Web/UI/WebControls/TImageButton.php11
2 files changed, 13 insertions, 4 deletions
diff --git a/framework/Web/UI/WebControls/TButton.php b/framework/Web/UI/WebControls/TButton.php
index 304710e9..aa4e21a7 100644
--- a/framework/Web/UI/WebControls/TButton.php
+++ b/framework/Web/UI/WebControls/TButton.php
@@ -88,7 +88,7 @@ class TButton extends TWebControl implements IPostBackEventHandler, IButtonContr
$writer->addAttribute('value',$this->getText());
if($this->getEnabled(true))
{
- if($this->needPostBackScript() && $this->getEnableClientScript())
+ if($this->getEnableClientScript() && $this->needPostBackScript())
$this->renderClientControlScript($writer);
}
else if($this->getEnabled()) // in this case, parent will not render 'disabled'
@@ -135,8 +135,8 @@ class TButton extends TWebControl implements IPostBackEventHandler, IButtonContr
*/
protected function needPostBackScript()
{
- return $this->canCauseValidation() || ($this->getButtonType()!==TButtonType::Submit &&
- ($this->hasEventHandler('OnClick') || $this->hasEventHandler('OnCommand')));
+ //IE needs JS to be rendered for default button to work if no validators are assigned to this button
+ return $this->canCauseValidation() || $this->hasEventHandler('OnClick') || $this->hasEventHandler('OnCommand');
}
/**
diff --git a/framework/Web/UI/WebControls/TImageButton.php b/framework/Web/UI/WebControls/TImageButton.php
index f5c331c1..41de5087 100644
--- a/framework/Web/UI/WebControls/TImageButton.php
+++ b/framework/Web/UI/WebControls/TImageButton.php
@@ -105,7 +105,7 @@ class TImageButton extends TImage implements IPostBackDataHandler, IPostBackEven
$writer->addAttribute('name',$uniqueID);
if($this->getEnabled(true))
{
- if($this->getEnableClientScript() && $this->canCauseValidation())
+ if($this->getEnableClientScript() && $this->needPostBackScript())
$this->renderClientControlScript($writer);
}
else if($this->getEnabled()) // in this case, parent will not render 'disabled'
@@ -148,6 +148,15 @@ class TImageButton extends TImage implements IPostBackDataHandler, IPostBackEven
}
/**
+ * @return boolean whether the button needs javascript to do postback
+ */
+ protected function needPostBackScript()
+ {
+ //IE needs JS to be rendered for default button to work if no validators are assigned to this button
+ return $this->canCauseValidation() || $this->hasEventHandler('OnClick') || $this->hasEventHandler('OnCommand');
+ }
+
+ /**
* Returns postback specifications for the button.
* This method is used by framework and control developers.
* @return array parameters about how the button defines its postback behavior.