Submit a form into a popup

Sometimes it is useful to submit a form into a popup window, here are two simple ways to do it (simple is the key here, so popup blockers don’t think it’s spam) :

<form action="foo.php" method="post" target="POPUPW"
onsubmit="POPUPW = window.open('about:blank','POPUPW',
'width=600,height=400');">
...
<input type="submit" name="sub" value="Submit in Popup">
</form>


– or –

<form action="foo.php" method="post" name="myform">
...
<input type="submit" name="subpopup" value="Submit in Popup"
onclick="myform.target='POPUPW'; POPUPW = window.open(
'about:blank','POPUPW','width=600,height=400');">
<input type="submit" name="subnormal" value="Submit Normal">
</form>


and on a similar topic here is a way to do simple link popups (so they also work with no javascript enabled)

<a href="test.htm" target="pop" onclick="pop=window.open(this.href,'pop',
'width=650,height=400');">link</a>

link

1 thought on “Submit a form into a popup

Leave a Reply

Your email address will not be published. Required fields are marked *