00001 <?php
00002
00015 class TKRadioButton extends TKFormInput {
00023 public function __construct($groupName, $value, $checked = false) {
00024 parent::__construct('radio', $groupName, $value);
00025
00026 $this->addProperty('checked', self::PROP_BOOLEAN);
00027 $this->set('checked', $checked);
00028
00029 $this->addEvent('oncheck', self::EVENT_INDIRECT);
00030 $this->addEvent('onuncheck', self::EVENT_INDIRECT);
00031
00032 $this->setAction('onchange', "if(this.checked==true){ ");
00033 $this->setAction('onchange', new TKEmitAction($this, 'oncheck'));
00034 $this->setAction('onchange', "}else{ ");
00035 $this->setAction('onchange', new TKEmitAction($this, 'onuncheck'));
00036 $this->setAction('onchange', "}");
00037 }
00038
00040 public function renderComponent($class, $style, $events, $id) {
00041 if($this->get('checked') == true)
00042 $events .= " checked=\"checked\"";
00043 return parent::renderComponent($class, $style, $events, $id);
00044 }
00045 }