Have the values of several checkboxes in array


#1

Hi there,

I am trying to do this to get all checked checkboxes as array in $form->model->get(‘group_tour_type_filter’):

foreach($tour_type as $tt) {
     $form->addField('group_tour_type_filter['.$tt->get('id').']', ['CheckBox', 'caption' => $tt->get('name')]);
}

Unfortunately, this does not work: The checkboxes can’t even be checked. So this seems to be an SUI issue.

Even without a single checkbox checked, the form model should still have the field group_tour_type_filter. But if I try to get it in onSubmit function, it throws an Exception:

Fatal Error
atk4\\data\\Exception: Field is not defined inside a Model

Code in onSubmit causing this:

$form->onSubmit(function($f) use($wizard) {
        $wizard->memorize('group_tour_type_filter',    $f->model->get('group_tour_type_filter'));

Any quick ideas on this?