summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorxue <>2006-01-22 00:16:20 +0000
committerxue <>2006-01-22 00:16:20 +0000
commit0c1b167cebac83e63c05ef780f012d7117ed8b81 (patch)
tree66ef560beb1e5a3261ed3d7869213e4ff71a8d1b /framework
parente8e20e87941ae992afd49f2d70198b0e7437d58e (diff)
Fixed a few issues with TCheckBox, TLinkButton and TRadioButton.
Diffstat (limited to 'framework')
-rw-r--r--framework/Web/UI/WebControls/TCheckBox.php38
-rw-r--r--framework/Web/UI/WebControls/TLinkButton.php2
-rw-r--r--framework/Web/UI/WebControls/TRadioButton.php14
3 files changed, 26 insertions, 28 deletions
diff --git a/framework/Web/UI/WebControls/TCheckBox.php b/framework/Web/UI/WebControls/TCheckBox.php
index ae6dc8e4..47fabd20 100644
--- a/framework/Web/UI/WebControls/TCheckBox.php
+++ b/framework/Web/UI/WebControls/TCheckBox.php
@@ -168,7 +168,7 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl
*/
public function setChecked($value)
{
- $this->setViewState('Checked',$value,false);
+ $this->setViewState('Checked',TPropertyValue::ensureBoolean($value),false);
}
/**
@@ -185,7 +185,7 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl
*/
public function setAutoPostBack($value)
{
- $this->setViewState('AutoPostBack',$value,false);
+ $this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),false);
}
/**
@@ -247,12 +247,10 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl
$writer->addAttribute('title',$tooltip);
$needSpan=true;
}
- $onclick=null;
if($this->getHasAttributes())
{
$attributes=$this->getAttributes();
$value=$attributes->remove('value');
- $onclick=$attributes->remove('onclick');
if($attributes->getCount())
{
$writer->addAttributes($attributes);
@@ -269,16 +267,16 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl
if($this->getTextAlign()==='Left')
{
$this->renderLabel($writer,$clientID,$text);
- $this->renderInputTag($writer,$clientID,$onclick);
+ $this->renderInputTag($writer,$clientID);
}
else
{
- $this->renderInputTag($writer,$clientID,$onclick);
+ $this->renderInputTag($writer,$clientID);
$this->renderLabel($writer,$clientID,$text);
}
}
else
- $this->renderInputTag($writer,$clientID,$onclick);
+ $this->renderInputTag($writer,$clientID);
if($needSpan)
$writer->renderEndTag();
}
@@ -292,7 +290,7 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl
return $attributes;
else
{
- $attributes=new TMap;
+ $attributes=new TAttributeCollection;
$this->setViewState('LabelAttributes',$attributes,null);
return $attributes;
}
@@ -307,13 +305,27 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl
return $attributes;
else
{
- $attributes=new TMap;
+ $attributes=new TAttributeCollection;
$this->setViewState('InputAttributes',$attributes,null);
return $attributes;
}
}
/**
+ * @return string the value attribute to be rendered
+ */
+ protected function getValueAttribute()
+ {
+ if(($value=$this->getAttribute('value'))===null)
+ {
+ $value=$this->getID();
+ return $value===''?$this->getUniqueID():$value;
+ }
+ else
+ return $value;
+ }
+
+ /**
* Renders a label beside the checkbox.
* @param THtmlWriter the writer for the rendering purpose
* @param string checkbox id
@@ -333,13 +345,13 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl
* Renders a checkbox input element.
* @param THtmlWriter the writer for the rendering purpose
* @param string checkbox id
- * @param string onclick attribute value for the checkbox
*/
- protected function renderInputTag($writer,$clientID,$onclick)
+ protected function renderInputTag($writer,$clientID)
{
if($clientID!=='')
$writer->addAttribute('id',$clientID);
$writer->addAttribute('type','checkbox');
+ $writer->addAttribute('value',$this->getValueAttribute());
if(($uniqueID=$this->getUniqueID())!=='')
$writer->addAttribute('name',$uniqueID);
if($this->getChecked())
@@ -362,8 +374,8 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl
}
/**
- * Sets the post back options for this textbox.
- * @return TPostBackOptions
+ * Sets the post back options for this checkbox.
+ * @return array
*/
public function getPostBackOptions()
{
diff --git a/framework/Web/UI/WebControls/TLinkButton.php b/framework/Web/UI/WebControls/TLinkButton.php
index c24119e5..619f8e77 100644
--- a/framework/Web/UI/WebControls/TLinkButton.php
+++ b/framework/Web/UI/WebControls/TLinkButton.php
@@ -185,7 +185,7 @@ class TLinkButton extends TWebControl implements IPostBackEventHandler
*/
public function setCausesValidation($value)
{
- $this->setViewState('CausesValidation',$value,true);
+ $this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true);
}
/**
diff --git a/framework/Web/UI/WebControls/TRadioButton.php b/framework/Web/UI/WebControls/TRadioButton.php
index ee53107a..e756cba6 100644
--- a/framework/Web/UI/WebControls/TRadioButton.php
+++ b/framework/Web/UI/WebControls/TRadioButton.php
@@ -128,20 +128,6 @@ class TRadioButton extends TCheckBox
}
/**
- * @return string the value attribute to be rendered
- */
- private function getValueAttribute()
- {
- if(($value=$this->getAttribute('value'))===null)
- {
- $value=$this->getID();
- return $value===''?$this->getUniqueID():$value;
- }
- else
- return $value;
- }
-
- /**
* Renders a radiobutton input element.
* @param THtmlWriter the writer for the rendering purpose
* @param string checkbox id