Where to define parameter for searchModel

hi guys, i will get following error using JQuery-Searchfunction in yii2




Bad request(#400)

Missing parameters



I know,that SearchModel requires in this case id as parameter, but unless Searchfunction won’t be rendered in controller,I have no idea,where to implement parameter passing.

I try like this, but didn’t succeed with it:

First in GridView(index.php)







$search = "$('.search-button').click(function(){

$('.search-form_adressen').toggle(1000);

return false;

});";

$this->registerJs($search);

<div class="search-form_adressen" style="display:none">

    <?= $this->render('_search', ['model' => $searchModel,'id'=>6]); ?>

</div>



Second in _seach.php(formular)







    <div class="form-group">

        <?= Html::submitButton(Yii::t('app', 'Searching'), ['class' => 'btn btn-primary','id'=>6]) ?>

        <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?>

    </div>

Here is Searchmodel

Any ideas, where to implement parameter passing correctly?

Got it by my own. Finally

There are two positions defining id. First is in View like this





    <?=

    $this->render('_search', [

        'model' => $searchModel,

        'id' => $id,

    ]);

    ?>



Second is ActiveForm in _search.php like this:





 <?php

]    $form = ActiveForm::begin([

                'action' => ['index','id'=>$id],

                'method' => 'get',

    ]);

   //var_dump($form);

    ?>



So, this thread can be closes as succesfully solved