Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form submit with popup box

Status
Not open for further replies.

emozley

Technical User
Jan 14, 2003
769
GB
Hi,

I have a function for opening a page in a popup box:

<SCRIPT>
function newwindow(theUrl) {
window.open(theUrl, 'jav', 'width=640,height=320,resizable=no,scrollbars=auto');
}
</SCRIPT>

And I also have a form:

<form method="post" action="theform.asp">
<input type="checkbox" onclick="submit()">
<input type="hidden" name="UserID" value="1">
</form>

Is there a way of making it so that when someone clicks on the checkbox the page "theform.asp" opens up in a popup window using the newwindow function?

Thanks very much

Ed
 
Code:
<form method="post" action="theform.asp">
  <input type="checkbox" onclick="newwindow('theform.asp')">
  <input type="hidden" name="UserID" value="1">
</form>

hth,
Matt
 
Or do you want to submit the form data to a pop up?

If so...
Code:
<form method="post" action="theform.asp" target="_blank">
  <input type="checkbox" onclick="this.submit()" />
  <input type="hidden" name="UserID" value="1" />
</form>
IMO, that's the easiest thing to do...

Matt
 
Hi,

Thanks for the reply to this - yep I would like the form data submitted to the popup. Your 2nd example submits to a new whole page rather than using a popup - is it possible to combine the two?

Thanks very much

Ed
 
<input type="checkbox" onclick="submit()">
[tt]<input type="checkbox" onclick="function newwindow(this.form.action);this.form.target='jav';this.form.submit();">[/tt]
 
correction
I actually meant this.
[tt] <input type="checkbox" onclick="[red]newwindow('')[/red];this.form.target='jav';this.form.submit();">[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top