summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorxue <>2005-12-29 19:58:07 +0000
committerxue <>2005-12-29 19:58:07 +0000
commit94e49ca4633600269831c4e80af25ddcfa3a8258 (patch)
treeb31d0c1fd9ac7dfd12a75e42ba7d049a2b912178 /framework
parentc38c1e6f271f73e5d9474e63bca227e2b7a30db8 (diff)
Added TTextBox demos.
Diffstat (limited to 'framework')
-rw-r--r--framework/Web/UI/WebControls/TStyle.php2
-rw-r--r--framework/Web/UI/WebControls/TTextBox.php19
2 files changed, 15 insertions, 6 deletions
diff --git a/framework/Web/UI/WebControls/TStyle.php b/framework/Web/UI/WebControls/TStyle.php
index bb1d733a..02f0de29 100644
--- a/framework/Web/UI/WebControls/TStyle.php
+++ b/framework/Web/UI/WebControls/TStyle.php
@@ -296,7 +296,7 @@ class TStyle extends TComponent
{
$arr=explode(':',$style);
if(isset($arr[1]) && trim($arr[0])!=='')
- $writer->addStyleAttribute(trim($arr[0]),trim($arry[1]));
+ $writer->addStyleAttribute(trim($arr[0]),trim($arr[1]));
}
}
foreach($this->_data as $name=>$value)
diff --git a/framework/Web/UI/WebControls/TTextBox.php b/framework/Web/UI/WebControls/TTextBox.php
index 905cc1e1..00d75e75 100644
--- a/framework/Web/UI/WebControls/TTextBox.php
+++ b/framework/Web/UI/WebControls/TTextBox.php
@@ -43,6 +43,14 @@
class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
{
/**
+ * Default number of rows (for MultiLine text box)
+ */
+ const DEFAULT_ROWS=4;
+ /**
+ * Default number of columns (for MultiLine text box)
+ */
+ const DEFAULT_COLUMNS=20;
+ /**
* @var array list of auto complete types
*/
private static $_autoCompleteTypes=array('BusinessCity','BusinessCountryRegion','BusinessFax','BusinessPhone','BusinessState','BusinessStreetAddress','BusinessUrl','BusinessZipCode','Cellular','Company','Department','Disabled','DisplayName','Email','FirstName','Gender','HomeCity','HomeCountryRegion','HomeFax','Homepage','HomePhone','HomeState','HomeStreetAddress','HomeZipCode','JobTitle','LastName','MiddleName','None','Notes','Office','Pager','Search');
@@ -69,9 +77,9 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
if(($textMode=$this->getTextMode())==='MultiLine')
{
if(($rows=$this->getRows())<=0)
- $rows=2;
+ $rows=self::DEFAULT_ROWS;
if(($cols=$this->getColumns())<=0)
- $cols=20;
+ $cols=self::DEFAULT_COLUMNS;
$writer->addAttribute('rows',"$rows");
$writer->addAttribute('cols',"$cols");
if(!$this->getWrap())
@@ -119,6 +127,7 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
$writer->addAttribute('disabled','disabled');
if($this->getAutoPostBack() && $page->getClientSupportsJavaScript())
{
+ $writer->addAttribute('id',$this->getClientID());
$options = $this->getAutoPostBackOptions();
$scripts = $this->getPage()->getClientScript();
$postback = $scripts->getPostBackEventReference($this,'',$options,false);
@@ -337,16 +346,16 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
*/
public function getRows()
{
- return $this->getViewState('Rows',0);
+ return $this->getViewState('Rows',self::DEFAULT_ROWS);
}
/**
* Sets the number of rows displayed in a multiline text box.
- * @param integer the number of rows, set it 0 to clear the setting
+ * @param integer the number of rows
*/
public function setRows($value)
{
- $this->setViewState('Rows',TPropertyValue::ensureInteger($value),0);
+ $this->setViewState('Rows',TPropertyValue::ensureInteger($value),self::DEFAULT_ROWS);
}
/**