diff options
author | xue <> | 2006-05-30 11:49:38 +0000 |
---|---|---|
committer | xue <> | 2006-05-30 11:49:38 +0000 |
commit | 90bc19ec007ede40268b5fe5df38fe29b1b0ece2 (patch) | |
tree | c967715be24cbe1cb2398128beea5c662cfebcf6 | |
parent | a21589b8e1292e2ba8b2a09e20d1bd0c4e2216b6 (diff) |
onClick javascript event triggered twice on CheckBox label
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TCheckBox.php | 15 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TRadioButton.php | 5 |
3 files changed, 16 insertions, 5 deletions
@@ -8,6 +8,7 @@ BUG: Ticket#167 - TSecurityManager issues warning when trying to encrypt/decrypt BUG: Ticket#169 - Validation of subclass of THtmlArea/TDatePicker fails (Wei)
BUG: Ticket#179 - CGI incompatibility causing clientscripts.php failure (Qiang)
BUG: Ticket#181 - Unable to change Content-Type in response header if charset is not set (Qiang)
+BUG: Ticket#200 - onClick javascript event triggered twice on CheckBox label (Qiang)
ENH: Ticket#150 - TDataGrid and TDataList now render table section tags (Qiang)
ENH: Ticket#152 - constituent parts of TWizard are exposed (Qiang)
ENH: added sanity check to calling event handlers (Qiang)
diff --git a/framework/Web/UI/WebControls/TCheckBox.php b/framework/Web/UI/WebControls/TCheckBox.php index 681c8748..3eb486f3 100644 --- a/framework/Web/UI/WebControls/TCheckBox.php +++ b/framework/Web/UI/WebControls/TCheckBox.php @@ -240,6 +240,8 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl {
$attributes=$this->getAttributes();
$value=$attributes->remove('value');
+ // onclick js should only be added to input tag
+ $onclick=$attributes->remove('onclick');
if($attributes->getCount())
{
$writer->addAttributes($attributes);
@@ -248,6 +250,8 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl if($value!==null)
$attributes->add('value',$value);
}
+ else
+ $onclick='';
if($needSpan)
$writer->renderBeginTag('span');
$clientID=$this->getClientID();
@@ -256,16 +260,16 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl if($this->getTextAlign()==='Left')
{
$this->renderLabel($writer,$clientID,$text);
- $this->renderInputTag($writer,$clientID);
+ $this->renderInputTag($writer,$clientID,$onclick);
}
else
{
- $this->renderInputTag($writer,$clientID);
+ $this->renderInputTag($writer,$clientID,$onclick);
$this->renderLabel($writer,$clientID,$text);
}
}
else
- $this->renderInputTag($writer,$clientID);
+ $this->renderInputTag($writer,$clientID,$onclick);
if($needSpan)
$writer->renderEndTag();
}
@@ -334,14 +338,17 @@ 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 js
*/
- protected function renderInputTag($writer,$clientID)
+ protected function renderInputTag($writer,$clientID,$onclick)
{
if($clientID!=='')
$writer->addAttribute('id',$clientID);
$writer->addAttribute('type','checkbox');
if(($value = $this->getValueAttribute()) !== '')
$writer->addAttribute('value',$value);
+ if($onclick!=='')
+ $writer->addAttribute('onclick',$onclick);
if(($uniqueID=$this->getUniqueID())!=='')
$writer->addAttribute('name',$uniqueID);
if($this->getChecked())
diff --git a/framework/Web/UI/WebControls/TRadioButton.php b/framework/Web/UI/WebControls/TRadioButton.php index 9a523b55..2ccda96b 100644 --- a/framework/Web/UI/WebControls/TRadioButton.php +++ b/framework/Web/UI/WebControls/TRadioButton.php @@ -139,14 +139,17 @@ class TRadioButton extends TCheckBox * Renders a radiobutton input element.
* @param THtmlWriter the writer for the rendering purpose
* @param string checkbox id
+ * @param string onclick js
*/
- protected function renderInputTag($writer,$clientID)
+ protected function renderInputTag($writer,$clientID,$onclick)
{
if($clientID!=='')
$writer->addAttribute('id',$clientID);
$writer->addAttribute('type','radio');
$writer->addAttribute('name',$this->getUniqueGroupName());
$writer->addAttribute('value',$this->getValueAttribute());
+ if($onclick!=='')
+ $writer->addAttribute('onclick',$onclick);
if($this->getChecked())
$writer->addAttribute('checked','checked');
if(!$this->getEnabled(true))
|