Submit the form in a new tab

I would like (just to check some functions after I avoid this behavior) to load a page called by sending to a new tab: is this possible?

+116
jquery php html-form html-form-post
Apr 18 '11 at 10:21
source share
8 answers
<form target="_blank" [....] 

will present the form in a new tab ... I'm not sure if this is what you are looking for, please explain better ...

+232
Apr 18 2018-11-21T00:
source share

I have a [submit] and [preview] button. I want the preview to show the print type of the submitted form data without saving it in the database. Therefore, I want the [preview] to open in a new tab and go to send data in the same window / tab.

 <button type="submit" id="liquidacion_save" name="liquidacion[save]" onclick="$('form').attr('target', '');">Save</button></div> <div> <button type="submit" id="liquidacion_Previsualizar" name="liquidacion[Previsualizar]" onclick="$('form').attr('target', '_blank');">Preview</button></div> 
+22
Oct 30 '13 at 19:29
source share

Add target="_blank" to the <form> .

+13
Apr 18 2018-11-21T00:
source share

You can also use the new button attribute named formtarget that was introduced in HTML5.

 <form> <input type="submit" formtarget="_blank"/> </form> 
+10
Mar 06 '18 at 13:52
source share

Since you have this tagged jQuery, I assume you want something to stick to your successful function?

 success: function(data){ window.open('http://www.mysite.com/', '_blank'); } 
+7
Apr 18 2018-11-21T00:
source share

Try using jQuery

 <script type="text/javascript"> $("form").submit(function() { $("form").attr('target', '_blank'); return true; }); </script> 

Here is the complete answer - http://ftutorials.com/open-html-form-in-new-tab/

+4
Sep 15 '13 at 23:34 on
source share

Browser options must be set to open new windows in a new tab, otherwise a new browser window opens.

+1
Jun 28 2018-12-12T00:
source share

This also works great, and you can do something else while the new tab handler submits.

 <form target="_blank"> <a href="#">Submit</a> </form> <script> $('a').click(function () { // do something you want ... $('form').submit(); }); </script> 
+1
Mar 09 '15 at 9:56
source share



All Articles