Skip to content

Latest commit

 

History

History
33 lines (26 loc) · 711 Bytes

checkbox-list.md

File metadata and controls

33 lines (26 loc) · 711 Bytes

Checkbox List Field

Represents a list of checkboxes with multiple selection.

Usage Example

Widget:

use Yiisoft\Form\Field\CheckboxList;

echo CheckboxList::widget()
    ->name('CheckboxListForm[color]')
    ->label('Select one or more colors')
    ->hint('Color of box.')
    ->items([
        'red' => 'Red',
        'blue' => 'Blue',
    ]);

Result will be:

<div>
    <label>Select one or more colors</label>
    <div>
        <label><input type="checkbox" name="CheckboxListForm[color][]" value="red"> Red</label>
        <label><input type="checkbox" name="CheckboxListForm[color][]" value="blue"> Blue</label>
    </div>
    <div>Color of box.</div>
</div>