From 56fee292c37e162c03fab9eeadd6a8b9ab85c251 Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 4 Sep 2006 19:15:47 +0000 Subject: merge from 3.0 branch till 1387 --- framework/Web/UI/WebControls/TButton.php | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'framework/Web/UI/WebControls/TButton.php') 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 + * @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'; +} + ?> -- cgit v1.2.3