hello,
does anyone have a working example of preselected values in the multiselect button?
ie have an array and show those items as checked.
I am using 2amigos multi select widget
http://davidstutz.github.io/bootstrap-multiselect/
thx
Dennis
hello,
does anyone have a working example of preselected values in the multiselect button?
ie have an array and show those items as checked.
I am using 2amigos multi select widget
http://davidstutz.github.io/bootstrap-multiselect/
thx
Dennis
I also could not make this works…
Bu using kartik/select2 it’s working without any problem
Thanks for the note. After a couple days of trying i gave up and created my own version with checkboxes and jquery. Bit of a learning process but now its working.
The expected value for $selected is array, or string matching EXACTLY one of the options.
$attrs['selected'] = $selection !== null &&
(!is_array($selection) && !strcmp($key, $selection)
|| is_array($selection) && in_array($key, $selection));
$lines[] = static::tag('option', str_replace(' ', ' ', static::encode($value)), $attrs);
A workaround is to create a method in your model getValueAsArray() and set ‘attribute’ => ‘valueAsArray’;.
After that handle it manually on submit … and no idea how the validation can work.