Best practice select the value from gridview in modal form

Hi Everyone,

In a parent form, i have a field and a button. this button show the modal dialogue contains gridview. After i click the value or row i want, i want to pass to the parent form (in a field).

how to perform like this.

here the illustration

parent form

modal form

I cannot perform search in modal-form, why?

this is my parent form script to show the modal

<div class="col-xs-8">

            <div class="form-group field-poagen-price"> 


            <?= Html::button('Price List', ['value' => Url::to('../pricelist/list'), 'class' => 'btn btn-primary', 'id' => 'BtnModalPriceList']) ?>



                        'header' => 'List Harga',

                        'id' => 'modal',

                        'size' => 'modal-md'


                echo "<div id='modalContent'></div>";





Please advice from the Yii2 Masters. Thanks before.

I will suggest you to use jQuery ajax to search because simple search with model might not work. Once you will make search and click on submit it could reload the page. or you can try pjax also.


thanks for the reply. Could you show me some example?

thanks before

Finally, I found the answer.

  1. Modal dialogue must put outside of the active form.

  2. using pjax by giving the id like

<?php Pjax::begin(['id' => 'some-id']); ?>