select() public method

For example: $this->form->select('colors', array(1 => 'red', 2 => 'green', 3 => 'blue'), array( 'id' => 'Colors', 'value' => 2 )); Renders a '` element. $list array An associative array of key/value pairs, which will be used to render the list of options. $options array Any HTML attributes that should be associated with the `` element.
示例#1
0
 public function select($name, $list = array(), array $options = array())
 {
     $defaults = array('multiple' => false, 'hidden' => true);
     $options += $defaults;
     $out = parent::select($name, $list, $options);
     if ($options['multiple'] && $options['hidden']) {
         return $this->hidden($name . '[]', array('value' => '', 'id' => false)) . $out;
     }
     return $out;
 }