« Return to all random blog posts

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:
Show comments