I have very weird behaviour of the checkbox. I am doing a page in YII2 where I have some checkbox with different options, I need to collect all of them and add to Data Base. My problem is that I can't collect any data. the view have this form.
<?php $form1 = ActiveForm::begin(); ?>
<?=
DetailView::widget([
'model' => $model,
'condensed' => false,
'enableEditMode' => false,
'hover' => true,
'labelColOptions' => ['style' => 'width:20%; text-align:left !important; '],
'mode' => DetailView::MODE_VIEW,
'vAlign' => DetailView::ALIGN_MIDDLE,
'valueColOptions' => ['style' => 'vertical-align: middle; '],
'panel' => [
'heading' => Yii::t('api', 'Description_a'),
'type' => 'company',
],
'attributes' => [
[
'group' => true,
'label' => Yii::t('api', 'actions_grup1'),
'rowOptions' => ['class' => 'info']
],
['label' => Html::checkbox('101', false, ['label' => Yii::t('api', 'Action1')]),
'value' =>Yii::t('api', 'Description_1'),
],
['label' => Html::checkbox('102', false, ['label' => Yii::t('api', 'Action2')]),
'value' =>Yii::t('api', 'Description_2'),
],
],
],
]);
<?= Html::a(Yii::t('api','create_new'), ['controller/create'], ['class' => 'btn btn-success' ]) ?>
<?php ActiveForm::end(); ?>
even that all check box on definition have false on inspect I can see the * value="1"* and also in the function create in controller I have just one this now
$post=Yii::$app->request->post();
var_dump($post);
exit;
the $post is array(0) { } no meter if I click or not to some checkbox to be checked Can someone tell me what I am doing wrong? Or what I am missing?
Aucun commentaire:
Enregistrer un commentaire