submit form data to a new window failed using HTTP POST

M

Matt

The following program submit a FORM DATA to a new window using HTTP
POST,
and postprocess.jsp couldn't get the form data. If I do in GET method
and pass
by query string in windowURL, then it works. But I need HTTP POST
method,
and I cannot use target="_blank" because I need to control the new
window's
properties (disable the scrollbars, menubars, etc...)

Are there any workarounds?

<html>
<script type="text/javascript">
function checkAndSubmitForm(theForm)
{
var windowURL = theForm.action;
window.open(windowURL, "newWin",
"scrollbars=0,menubar=0,toolbar=0,location=0,status=0");
}
</script>

<body>
<FORM NAME="formname" method="POST" action="postprocess.jsp">
<P><input type=text" name="username"/>
<P><input type="button" name="submitBtn" value="Submit Form"
onClick="checkAndSubmitForm(document.formname)">
</FORM>
</body>
</html>

postprocess.jsp is just one line statement to get the form data
<%= Request.Form() %>


any ideas? please help!! thanks!!
 
V

VK

var w = window.open("bogus.html", "newWin", ...);
theForm.target = "newWin";
theForm.submit();

where bogus.html is an empty placeholder. may use "about:blank" instead
which is more elegant but doesn't go smoothly with all browsers.

good luck!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,161
Latest member
GertrudeMa
Top