Checkbox

form

Select multiple value from predefined options.

Example
HTML code
<DIV class="checkbox">
    <LABEL class="is-selected">
        <INPUT type="checkbox" id="name_1" name="name" value="1" checked />Title</LABEL>
        <INPUT data-role='event_trigger' type="hidden" id="name" value="1" />
    </DIV>
Type atom
Group form
Todo
BEM checkbox__label
Style: Color, Sizes.
All events? (only onchange set)
More examples

Buttons

Pills

PHP

Wrapper to use element through PHP

Extends eUiElementSelect
Render html
Create arguments name, value, option, title, icon
Code example

Basic

$this->get('ui', 'checkbox', 'name', $value, 'optionValue', 'optionTitle');

Basic, array

$this->get('ui', 'checkbox', Array(
    'name'      => 'name',
    'value'     => $value,
    'option'    => '100',
    'title'     => 'Label text'
));

Multiple choices

$this->get('ui', 'checkbox', Array(
    'name'      => 'name', // adds [] to name!!
    'value'     => $value,
    'options'   => Array(
        Array(
          'value' => '1',
          'title' => 'One'
        ),
        Array(
          'value' => '2',
          'title' => 'Two'
        )
    )
));

All parameters

$this->get('ui', 'checkbox', Array(
    'name'      => 'form_name',
    'value'     => $value, // Selected value
    'default'   => '2',
    'allownull' => true, // Add empty value (Sends something, if nothing is selected)
    'style'     => 'button stacked',
    'tooltip'   => 'For whole group',
    'onchange'  => 'For all options',
    'options'   => Array(
        Array(
            'value'    => '1',
            'id'       => 'form_id',
            'name'     => 'form_name',
            'title'    => 'One',
            'icon'     => 'app-warning',
            'color'    => 'green',
            'tooltip'  => 'Option tooltip',
            'onchange' => 'runMeForThisOption()'
        ),
    )
));

Styles

Elements Css style

button
pill
stacked
border
image