diff options
Diffstat (limited to 'framework/Web/UI')
| -rw-r--r-- | framework/Web/UI/WebControls/TTextBox.php | 19 | 
1 files changed, 19 insertions, 0 deletions
| 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);
 @@ -274,6 +276,23 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable  	}
  	/**
 +	 * @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.
  	 */
  	public function getCausesValidation()
 | 
