tag_body_start = ""; $this->options['value'] = $value; $this->AddItem($caption); $this->SetSelected($selected); $this->SetEnabled($enabled); } function SetValue($value) { return $this->options['value'] = $value; } function GetValue() { return $this->GetOption('value'); } function SetCaption($value=NULL) { $this->AddItem(nbsp($value)); } function SetSelected($value='yes') { if((is_string($value) && ($value == 'yes' || $value == "selected" || $value=='on')) || (is_int($value) && $value<>0)) return $this->options['selected'] = 'selected'; $this->DelOption('selected'); } } class CComboBox extends CTag { /* private */ //var $value; /* public */ function CComboBox($name='combobox',$value=NULL,$action=NULL) { parent::CTag('select','yes'); $this->tag_end = ''; $this->options['class'] = 'biginput'; $this->options['name'] = $name; $this->value = $value; $this->options['size'] = 1; $this->SetAction($action); } function SetAction($value='submit()', $event='onchange') { $this->AddOption($event,$value); } function SetValue($value=NULL) { $this->value = $value; } function AddItem($value, $caption='', $selected=NULL, $enabled='yes') { // if($enabled=='no') return; /* disable item method 1 */ if(is_null($selected)) { $selected = 'no'; if($value == $this->value || (is_array($this->value) && in_array($value, $this->value))) $selected = 'yes'; } parent::AddItem(new CComboItem($value,$caption,$selected,$enabled)); } } class CListBox extends CComboBox { /* public */ function CListBox($name='listbox',$value=NULL,$size=5,$action=NULL) { parent::CComboBox($name,NULL,$action); $this->options['multiple'] = 'multiple'; $this->options['size'] = $size; $this->SetValue($value); } function SetSize($value) { $this->options['size'] = $value; } } function inseret_javascript_for_editable_combobox() { if(defined('EDITABLE_COMBOBOX_SCRIPT_INSERTTED')) return; define('EDITABLE_COMBOBOX_SCRIPT_INSERTTED', 1); ?> value || (is_array($this->value) && in_array($value, $this->value))) $this->value_exist = 1; } parent::AddItem($value,$caption,$selected,$enabled); } function ToString($destroy=true) { if(!isset($this->value_exist) && !empty($this->value)) { $this->AddItem($this->value, $this->value, 'yes'); } return parent::ToString($destroy); } } ?>