PDA

View Full Version : Can I make a form post to a popup window?


rexselin
08-20-2004, 02:21 AM
Hi all,

I have a requirement in which I need to open a popup window . I need to pass on so many data also to this popup window.

As of now am doing it like ,

<script language="JavaScript">
window.open('mypopupwindow.html?query1=23&query2=3734','details',"height="+height+",width="+width+",status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes");
</script>

The length of my query string is getting increased as I need to pass more and more values to that pop up window page. I know I can make a form post to a new window like


<form action=mypopupwindow.html target="new">

But in this case,I wouldn't be able to control the properties of the popup window like height,width,toolbars etc.

Does anyone know how I cam make this work?

Thanks in advance.
Regards,
Celia

scoutt
08-20-2004, 09:14 AM
you put a onclick in the submit button and it will call the popup page you have. leave the action out.

<Input Type="button" value="click here!" onclick="go_now();">


then you do something like this in the body of the page in the popup

<script language=javascript>
function set_form_data(){
var parent=window.opener.form1.textbox1.value;
window.document.form2.textbox2.value=parent;
}
</script>
</head>
<body onload="set_form_data();">

rexselin
08-21-2004, 01:25 AM
does this mean that I need to have all the POST variables as form field variables( like document.formname.elementname) in the popup page?

scoutt
08-21-2004, 10:19 AM
yes