0

i have a form to submit like this

<form role="form" action="{{ url('panel/print/direport') }}" id="printForm" method="post" class="form-horizontal">
    <input type="hidden" name="_token" value="{{ csrf_token() }}">
    <input type="hidden" name="dfno" value="{{ $dfno }}" class="form-control">
    <input type="hidden" name="bonperiod" value="{{ $bonperiod }}" class="form-control">
    <input type="hidden" name="bonstuck" value="{{ $bonstuck }}" class="form-control">
    <input type="hidden" name="boninc" value="{{ $boninc }}" class="form-control">
    <input type="hidden" name="userids" value="{{ $userids }}" class="form-control">
</form>
<button type="button" onclick="document.getElementById('printForm').submit();" class="btn btn-primary">
<i class="glyphicon glyphicon-print"></i>&nbsp; Print</button>

usually if we want to the form submit to open new tab we just need to add target="_blank", my question is how to open new browser window when i click the button submit form?

Dave
  • 3,073
  • 7
  • 20
  • 33
Idham Choudry
  • 589
  • 10
  • 31

3 Answers3

0

please try like this with js

$('.btn-primary').click(function () {
   var url="http://www.yoursite.com";
   window.open(url,'NewWindow','width=600,height=600');
});
anuraj
  • 157
  • 8
0

Two Way I Given Here

<form action="..." ...
onsubmit="window.open('google.html', '_blank', 'scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=no,status=no');return true;">

Also We can Use

<form target="_blank" action="http://example.com"
  method="post" id="mc-embedded-subscribe-form"
  name="mc-embedded-subscribe-form" class="validate">
Samudrala Ramu
  • 2,088
  • 1
  • 15
  • 36
0

It can be done bywindow.open method when you give height and width attribute to it

Refer the link for detail information JavaScript open in a new window, not tab

Community
  • 1
  • 1
Annalaxmi
  • 135
  • 1
  • 8