Submit a form into a popup

Sometimes it is useful to subimt a form into a popup window, here's a few ways to do it:
<form action="foo.php" method="post" target="POPUPW"
onsubmit="POPUPW = window.open(this.action,'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(
this.action,'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>
Comments
  1. Gravatar

    Brian Wilson

    Reply

    I tried the first one and it works in Firefox but Internet Explorer pops up the box and opens another new window in a tab. Any thoughts?



Leave a Comment

Yes, send me an email when a new comment is posted.

The avatars shown next to comments are Gravatars. Click here to get a Gravatar account for free and any other site that supports it will show your avatar too!