CheckBoxColumn doesn't work

Hi guys, following attempt deleting records using CheckBoxColumn in GridView fails. I have no idea, why?!Following code in Controller:





var_dump(Yii::$app->request->post('selection'));

var_dump($checkbox);

die();



will show this:




NULL

array(0){}



Here is code of GridView:





<?=

Html::beginForm(['/dateianhang/dateianhang/all', "RenderBackInCaseOfError" => $RenderBackInCaseOfError, "FKBezeichnung" => $FKBezeichnung, 'fk' => $id], 'post', ['name' => 'idAnhang']);

?>


<p>

    <?= Html::submitButton(Yii::t('app', 'Records löschen'), ['<span class="glyphicon glyphicon-trash"></span>', 'class' => 'btn btn-danger', 'title' => 'Records löschen', 'name' => 'button_checkBoxes']); ?>

</p>


<?php

$gridColumn = [

    [

        'class' => '\kartik\grid\CheckboxColumn', 'checkboxOptions' => function($model) {

            return ['value' => $model->id];

        },

    ],

.

.

[size=2]];[/size]

?><?=

Html::endForm();



Here is code of Controller:





public function actionAll($RenderBackInCaseOfError, $fk = NULL, $FKBezeichnung = NULL) {

        try {

            $session = new Session();

            $checkbox = (array) Yii::$app->request->post('selection');

            var_dump(Yii::$app->request->post('selection'));

            var_dump($checkbox);

            die();

            foreach ($checkbox as $item) {

                $this->actionDel($item, $RenderBackInCaseOfError);

            }



I have the same trouble using checkbox column within the yii form widget. This might not help you, but the way I get these to work is to forget the yii form wrapper and use regular html form tags.




<form action="your action.... >

<input type="hidden" name="_csrf" value="<?=Yii::$app->request->getCsrfToken()?>" />

//Gridview widget here

//Other form inputs & submit button

</form>



In the controller I process the array of selected id’s with


$_POST['selection']

I would be interested in how this is really supposed to work with the yii form and with Yii::$app->request->post(‘selection’).