-
1
- #1
I want to open a new window on form submit, that submits the page via the new open window.
I got it working, but just very occasionally it opens the new window, then opens another window for the form submission. I'm doing this:
<form name="form1" method="post"
action="MyProgram"
onSubmit="return openOnSubmit();"
target="onlinebkngs">
The target is a window i create via the openOnSubmit() javascript function, as below:
var floater;
function openOnSubmit {
floater = null;
//Build up window attributes via winStats
winStats = "status=yes,toolbar=no,location=no,directories=no,menubar=no,scrollbars,left=10,screenX=10,top=10,screenY=10";
// Set the size of the window
if (window.screen) {
var ah = screen.availHeight - 60;
var aw = screen.availWidth - 30;
winStats += ",height=" + ah;
winStats += ",innerHeight=" + ah;
winStats += ",width=" + aw;
winStats += ",innerWidth=" + aw;
}
else {
// Allow resize if can't get size
winStats+=",resizable";
}
// Set the name of the new window to "onlinebkngs"
// So that can submit form via it
floater=window.open("","onlinebkngs",winStats)
if (floater && floater.open) // if window opened ok...
return true;
else
return false;
}
I got it working, but just very occasionally it opens the new window, then opens another window for the form submission. I'm doing this:
<form name="form1" method="post"
action="MyProgram"
onSubmit="return openOnSubmit();"
target="onlinebkngs">
The target is a window i create via the openOnSubmit() javascript function, as below:
var floater;
function openOnSubmit {
floater = null;
//Build up window attributes via winStats
winStats = "status=yes,toolbar=no,location=no,directories=no,menubar=no,scrollbars,left=10,screenX=10,top=10,screenY=10";
// Set the size of the window
if (window.screen) {
var ah = screen.availHeight - 60;
var aw = screen.availWidth - 30;
winStats += ",height=" + ah;
winStats += ",innerHeight=" + ah;
winStats += ",width=" + aw;
winStats += ",innerWidth=" + aw;
}
else {
// Allow resize if can't get size
winStats+=",resizable";
}
// Set the name of the new window to "onlinebkngs"
// So that can submit form via it
floater=window.open("","onlinebkngs",winStats)
if (floater && floater.open) // if window opened ok...
return true;
else
return false;
}