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>