How to open in a new window for a submit button?

is it possible to open in a new window when i click submit button. I have TWO SUBMIT buttons in my active form.

I know if i give ‘target’=>’_blank’ i will get the desired result in normal cases but it didn’t work in active form.





 <?php $form = ActiveForm::begin(); ?>

        

      

    		<div class="form-group">

    			<div class="col-md-6">

    			<?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Submit') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>

    			</div>

    			<div class="col-md-6">

    				<?= Html::submitButton('Pdf', ['class' => 'btn btn-primary','name'=>'Pdf'],['target'=>'_blank']) ?>

    			</div>

    		</div>

    

        <?php ActiveForm::end(); ?>



I tried as above. then i decided to give target => _blank to active form as shown below


 

  <?php $form = ActiveForm::begin(

        ['options'=>['target'=>'_blank']]); ?>

it works but not the desired way. Now if i click both buttons i will be redirected to new page. I only want to get redirected to new page when i click on button ‘Pdf’.

Any Ideas?

I don’t want any javascript to be used.

i guess in both cases you need the content of the form you want to submit.

you just can give both submit buttons a name attribute and in your controller you can check which button had been submitted and processing.

only the clicked button’s name will be passed in the post parameters…