From 9d904fdfba3fd2925d7c121f2ec0d68a5ac18ab9 Mon Sep 17 00:00:00 2001 From: xue <> Date: Tue, 7 Feb 2006 02:38:25 +0000 Subject: Added AutoTrim property to TTextBox. --- framework/Web/UI/WebControls/TTextBox.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'framework') diff --git a/framework/Web/UI/WebControls/TTextBox.php b/framework/Web/UI/WebControls/TTextBox.php index 9427bb1f..5d508fd2 100644 --- a/framework/Web/UI/WebControls/TTextBox.php +++ b/framework/Web/UI/WebControls/TTextBox.php @@ -172,6 +172,8 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable public function loadPostData($key,$values) { $value=$values[$key]; + if($this->getAutoTrim()) + $value=trim($value); if(!$this->getReadOnly() && $this->getText()!==$value) { $this->setText($value); @@ -273,6 +275,23 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable $this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),false); } + /** + * @return boolean a value indicating whether the input text should be trimmed spaces. Defaults to false. + */ + public function getAutoTrim() + { + return $this->getViewState('AutoTrim',false); + } + + /** + * Sets the value indicating if the input text should be trimmed spaces + * @param boolean the value indicating if the input text should be trimmed spaces + */ + public function setAutoTrim($value) + { + $this->setViewState('AutoTrim',TPropertyValue::ensureBoolean($value),false); + } + /** * @return boolean whether postback event trigger by this text box will cause input validation, default is true. */ -- cgit v1.2.3