<?
class form_select extends component {



    function getOptionList() {
        return array();
    }



    function fillForm() {
        $elements = $this->templater->getElements();
        if(!empty($elements["\$t->field"])) {
            $element = $elements["\$t->field"];
        } else {
            $element = new HTML_Template_Flexy_Element;
            $element->tag = "select";
        }

        $element->attributes = array("name"=> $this->field);

        foreach($this->getOptionList() as $k => $v) {
            $option = new HTML_Template_Flexy_Element;
            $option->tag = "option";
            $option->attributes = array("value" => $k);
            $option->children = array($v);
            $element->children[] = $option;
        }
        $value = empty($_REQUEST[$this->field]) ? "" : $_REQUEST[$this->field];
        $element->setValue($value);

        $this->templater->elements[$this->field] = $element;
        parent::fillForm();
    }


}
?>