Get a form field select2 value by chosen id

Guys i have a select2 and i want get the id value of an object chosen by select2 form, i want that object id and i want set this in my url from another page.

<?= $form->field($model, ‘loja_id’)->widget(Select2::classname(), [

//'name' =&gt; 'loja_id',


'id' =&gt; 'loja_id',


'data' =&gt; ArrayHelper::map(Loja::find()-&gt;all(), 'id', 'nome') ,


'options' =&gt; ['placeholder' =&gt; 'Selecionar a loja existente...'],


'pluginOptions' =&gt; [


    'allowClear' =&gt; true


],


])-&gt;label('Selecionar lojas');


?&gt;

Html::a(Yii::t(‘app’, ‘Grupos/Listas’), ["/prec-politica-loja/indexloja?prec_politica_id=".Yii::$app->request->get(‘prec_politica_id’)."&loja_id=".????, ], [‘class’ => ‘btn btn-success’]) ?>

how to bind form value to url button?

You should use javascript or jQuery. Check online how to change an attribute of an element based on drop down list selection.