By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,946 Members | 1,714 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,946 IT Pros & Developers. It's quick & easy.

Open a popup on SOME submit buttons

P: n/a
I have a page where there are multiple submit buttons, some load the
next page in the same window to continue, and some need to open the page
in a popup for additional information. Therefore I cannot put the
onSubmit in the form tag, or it will cause them all to open in the
popup.

I tried putting the onSubmit into the submit tag, and that did pop up
the next page in a popup window, but none of the other input variables
are being passed to the page, so it displays an error instead of the
correct information.

Does anyone know how to do this?

Thanks,

Marshall

Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Marshall Dudley wrote:
I have a page where there are multiple submit buttons, some load the
next page in the same window to continue, and some need to open the page
in a popup for additional information. Therefore I cannot put the
onSubmit in the form tag, or it will cause them all to open in the
popup.
I tried putting the onSubmit into the submit tag, and that did pop up
the next page in a popup window, but none of the other input variables
are being passed to the page, so it displays an error instead of the
correct information.>
Does anyone know how to do this?


I found this code that may be useful for you:
http://www.sitepoint.com/forums/showthread.php?t=51550

The idea is to read out your form elements and put them into
MYSCRIPT.CGI?var1=a&var2=b. It works only with a GET-request:

<html>
<head>
<script language="javascript">
function submitFunction(i) {
if (i==1) {
document.theForm.target = "";
document.theForm.action = "MYSCRIPT.CGI?var1=a&var2=b";
}
if (i==2) {
document.theForm.target = "pWindow";
document.theForm.action = "MYSCRIPT.CGI?var1=a&var2=b";
window.open('','pWindow','width=500,height=400');
}
document.theForm.submit()
}
</script>
</head>
<body>
<form name="theForm">
<input type="button" value="Submit to _self"
onClick="submitFunction(1)">
<input type="button" value="Submit to popup"
onClick="submitFunction(2)">
</form>
</body>
</html>
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.