widgets\ActiveField listBox()

listBox() public method

Renders a list box.

The selection of the list box is taken from the value of the model attribute.

public $this listBox ( $items, $options = [] )
$items array

The option data items. The array keys are option values, and the array values are the corresponding option labels. The array can also be nested (i.e. some array values are arrays too). For each sub-array, an option group will be generated whose label is the key associated with the sub-array. If you have a list of data models, you may convert them into the format described above using yii\helpers\ArrayHelper::map().

Note, the values and labels will be automatically HTML-encoded by this method, and the blank spaces in the labels will also be HTML-encoded.

$options array

The tag options in terms of name-value pairs.

For the list of available options please refer to the $options parameter of yii\helpers\Html::activeListBox().

If you set a custom id for the input element, you may need to adjust the $selectors accordingly.

return $this

The field object itself.

doc_Yii
2016-10-30 17:17:53
Comments
Leave a Comment

Please login to continue.