Yii Framework Forum: How to send parameter with submitButton - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How to send parameter with submitButton [canceled]

#1 User is offline   tklustig 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 269
  • Joined: 20-April 17
  • Location:Hannover

Posted 03 December 2017 - 05:28 PM

Hi guys,
If I want to send parameter using link in anonymous function,I code like this:

      [
            'class' => 'yii\grid\ActionColumn',
            'template' => '{anlagen_index}<br><br>{anlagen_create}',
            'buttons' => [
                'anlagen_index' => function ($model, $id) {
                    return Html::a('<span class="glyphicon glyphicon-paperclip"></span>', ['/dateianhang/dateianhang/index', 'id' => $id->id_person], ['title' => 'Anlagen anzeigen', 'data' => ['pjax' => '0']]);
                },


In Controller, I code like this:

    public function actionIndex($id) {
.
.
    }

How to implement same thing with submittButton?
0

#2 User is offline   tklustig 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 269
  • Joined: 20-April 17
  • Location:Hannover

Posted 03 December 2017 - 06:31 PM

Got it by my own:


in GridView I code like this:
 <?= Html::submitButton('<span class="glyphicon glyphicon-trash"></span>',['title'=>'Records löschen','name' => 'button_cb']); ?>   


In Controller like this

    public function actionDelete_records() {
        $checkbox = (array) Yii::$app->request->post('selection');
        if (empty(($checkbox))&&(isset($_POST['button_cb']))) {
.
.
}


0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users