dcsimg
Opening new windows and doPost
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Edgar_Martinez
Posted On:   Thursday, March 29, 2001 03:02 PM

How can I create a new window that gets its parameters via doPost using javaScript. The only way I know to do that is using "window.open(url)" but with this way you must to send your parameters in the url, and get them via doGet.
Thanks.

Re: Opening new windows and doPost

Posted By:   Dave_Eaves  
Posted On:   Thursday, March 29, 2001 04:06 PM

The way that I've done this in the past is by creating a form on the html page that has a target the same as the window name that you're going to open. You can then write an openPostWindow function to be called on submit (this way you can specify a size and other attributes for your new window). I will attempt to provide an example below. Please note that I'm providing it without having tested this example first.


function openPostWindow()

{

// Note you have to point at some intermediary page first when the form posts the location of the new window will be replaced by your form's action.




window.open("blank.html","PostWindow","status,titlebar,directories,location,statusbar,menubar,toolbar,scrollbars,resizable");



}


I don't want the HTML to get messed up so I will just explain what the attributes of your form should be



method="POST"

action=

onsubmit="openPostWindow();"

target="PostWindow"


If this doesn't work right try using an onclick on the submit button to launch the window prior to the form submitting, or optionally you can call the javascript function onclick of a button and call
document.forms[0].submit();
after opening the window.


Hope this helps!

About | Sitemap | Contact