Yii Framework Forum: Html::submitButton should open in new tab - Yii Framework Forum

Jump to content

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

Html::submitButton should open in new tab

#1 User is offline   mrxc0d3r 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 12-October 17

Posted 12 October 2017 - 11:42 AM

Hi everybody,
How to add option target=>_blank in my code.

<?= Html::submitButton($model->isNewRecord ?    ' <i class="fa fa-save"></i>   Save & Print' : ' <i class="fa fa-save"></i>   Save & Print', ['target'=>'_blank'] , ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>


Anybody know this ? Thanks
0

#2 User is offline   umneeq 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 106
  • Joined: 10-October 11
  • Location:Russia

Posted 13 October 2017 - 08:16 AM

https://github.com/y...seHtml.php#L516
0

#3 User is offline   alrazi 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,315
  • Joined: 08-August 12
  • Location:Durban, South Africa

Posted 13 October 2017 - 01:57 PM

you can't put target=_blank on submit button

<?= Html::submitButton($model->isNewRecord ?    ' <i class="fa fa-save"></i>   Save & Print' : ' <i class="fa fa-save"></i>   Save & Print', ['target'=>'_blank'] , ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>

// your code outputs a button tag something like

<button>...</button>



change it to a anchor tag and your target=_blank should work as expected

<?= Html::a('Link', 'path_to_your_link', ['target'=>'_blank', 'class' => 'btn btn-primary']) ?>

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