Click to See Complete Forum and Search --> : window size


lingra
08-17-2003, 07:58 PM
Here is the senerio,

I have a full page (pageone.html) that opens a window for entering information. I use the javascript new=window.open() with the size set to 400 by 300. Within the new window the form action is set to "pageone.html" When the use clicks on the submit button pageone.html reapears but now it is the size of the new window.

How do I open a window from a full page, the new smaller window has a form that submits back to the first page, and have the first page remain full size? :confused:

Gollum
08-18-2003, 06:43 AM
Here is a solution...
pageone.html opens your popup window as normal (call it pagetwo.html), but when the user has finished entering their details, pagetwo doesn't submit them, but rather collects all the details and inserts them into hidden fields in pageone.html. It then submits pageone.html and closes itself.

Here's an example...
In pageone.html:

<form name=myForm method=post action=pageone.html>
<input type=hidden name=nameField>
</form>

and in pagetwo.html:

<form name=myForm>
Enter name:<input type=text name=nameField><br>
<input type=button value="Submit" onclick="mySubmit();">
</form>
<script>
function mySubmit()
{
window.opener.document.myForm.nameField.value = document.myForm.nameField.value;
window.opener.document.myForm.submit();
window.close();
}