diff options
author | xue <> | 2006-09-04 18:12:17 +0000 |
---|---|---|
committer | xue <> | 2006-09-04 18:12:17 +0000 |
commit | e83edc3f20163ac25e2307f9c854e7bc9384970c (patch) | |
tree | b5b22b7255a7b56168cea239108958e9a0fd6893 /framework/Web/UI/WebControls/TButton.php | |
parent | 85509ff45f9ae8795b7f6ef2c58a45d8a574f939 (diff) |
Finished updating code related with enumerable data types.
Diffstat (limited to 'framework/Web/UI/WebControls/TButton.php')
-rw-r--r-- | framework/Web/UI/WebControls/TButton.php | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/framework/Web/UI/WebControls/TButton.php b/framework/Web/UI/WebControls/TButton.php index d24f5ef4..09868b12 100644 --- a/framework/Web/UI/WebControls/TButton.php +++ b/framework/Web/UI/WebControls/TButton.php @@ -103,7 +103,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')));
}
@@ -254,20 +254,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';
+}
+
?>
\ No newline at end of file |