summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TButton.php
diff options
context:
space:
mode:
authorxue <>2006-09-04 19:15:47 +0000
committerxue <>2006-09-04 19:15:47 +0000
commit56fee292c37e162c03fab9eeadd6a8b9ab85c251 (patch)
tree923510b93c707868098ae4e5f404eb3766a59553 /framework/Web/UI/WebControls/TButton.php
parentb107cad91733d4a2a80f42cdbaab41a4f7b41c9d (diff)
merge from 3.0 branch till 1387
Diffstat (limited to 'framework/Web/UI/WebControls/TButton.php')
-rw-r--r--framework/Web/UI/WebControls/TButton.php31
1 files changed, 26 insertions, 5 deletions
diff --git a/framework/Web/UI/WebControls/TButton.php b/framework/Web/UI/WebControls/TButton.php
index f1132625..1dd239a4 100644
--- a/framework/Web/UI/WebControls/TButton.php
+++ b/framework/Web/UI/WebControls/TButton.php
@@ -119,7 +119,7 @@ class TButton extends TWebControl implements IPostBackEventHandler, IButtonContr
*/
protected function needPostBackScript()
{
- return $this->canCauseValidation() || ($this->getButtonType()!=='Submit' &&
+ return $this->canCauseValidation() || ($this->getButtonType()!==TButtonType::Submit &&
($this->hasEventHandler('OnClick') || $this->hasEventHandler('OnCommand')));
}
@@ -270,20 +270,41 @@ class TButton extends TWebControl implements IPostBackEventHandler, IButtonContr
}
/**
- * @return string the type of the button. Defaults to 'Submit'.
+ * @return TButtonType the type of the button. Defaults to TButtonType::Submit.
*/
public function getButtonType()
{
- return $this->getViewState('ButtonType','Submit');
+ return $this->getViewState('ButtonType',TButtonType::Submit);
}
/**
- * @param string the type of the button. Valid values include 'Submit', 'Reset', 'Button'.
+ * @param TButtonType the type of the button.
*/
public function setButtonType($value)
{
- $this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'Submit','Reset','Button'),'Submit');
+ $this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'TButtonType'),TButtonType::Submit);
}
}
+/**
+ * TButtonType class.
+ * TButtonType defines the enumerable type for the possible types that a {@link TButton} can take.
+ *
+ * The following enumerable values are defined:
+ * - Submit: a normal submit button
+ * - Reset: a reset button
+ * - Button: a client button (normally does not perform form submission)
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TButtonType extends TEnumerable
+{
+ const Submit='Submit';
+ const Reset='Reset';
+ const Button='Button';
+}
+
?>