i have a gridview of checkin model with checkbox action column
and on the same view i have form of model message with 2 field message and fileinput but i want to send one more data on the submit button click of message model form which is the keys of checkbox.
How can i so that?
it can be done only via javascript or there is some other technique as well?
here is my grid and view code
<div class="row">
<p>
<?php $form = ActiveForm::begin(['options'=>['enctype'=>'multipart/form-data']]); ?>
<div class="form-group col-xs-3 col-lg-3">
<?= $form->field($model, 'message')->textarea(['rows' => 6]) ?>
</div>
<div class="form-group col-xs-3 col-lg-3">
<?= $form->field($model, 'file')->fileInput() ?>
<div class="form-group">
<?= Html::submitButton('Send', ['class' => 'btn btn-danger','id'=>'sendMessage']) ?>
</div>
</div>
<?php ActiveForm::end(); ?>
</p>
</div>
<div class="checkin-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<?php Pjax::begin(['id' => 'checkin-grid', 'timeout' => false]); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'showOnEmpty'=>true,
'columns' => [
[
'class' => 'yii\grid\CheckboxColumn',
],
[
'attribute' => 'user_id',
'label' => 'Email',
'value' => 'users.email',
],
'user_type',
],
]);
?>
<?php Pjax::end(); ?>
And here is my checkin/index code where i can access the message and fileinput but i want list of keys as well...
So user must check at least one row before sending message
public function actionIndex()
{
$model = new Message();
$searchModel = new CheckinSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
'model' => $model,
]);
}