Forum Moderators: open

Message Too Old, No Replies

Passing data between two windows

Is this possible?

         

Argblat

8:48 pm on Feb 18, 2005 (gmt 0)

10+ Year Member



I'm sure the first question everyone will have is "why are you doing it this way?". My answer is that I am experimenting with this as an option. That being said,

In window #1 I have a group of textboxes [ready only] and a drop down menu. If the user picks from the data in the drop down, it populates the text boxes. HOWEVER, if the user chooses to create a new item, javascript pops open a new set-size window. This is window #2

In window #2 there are free text boxes [the same amount as on window #1, where the user can fill out their custom information.

My hope is that when they click save on the pop up window, I can pass the data to the original page, and have the pop up window close itself.

Is this possible without opening up a second window of page #1?

Here is some prototype code that I have:
---------------------------------------------------
Page #1:
<script>
var newwindow;
function newWindow(url)
{
newwindow=window.open(url,'name','height=300,width=500');
if (window.focus) {newwindow.focus()}
}
</script>

<table>
<tr>
<td>
<form>
<select name="Name">
<option>Name1</option>
<option>Name2</option>
<option>Name3</option>
<option>Name4</option>
<option onclick="newWindow('test2.htm');">New Shipper Info</option>
</select>
</form>

<input readonly type=text name="shipper1" size="50" maxlength="40" value="test1 - readonly"><br \>
<input readonly type=text name="shipper2" size="50" maxlength="40" value="test2 - readonly"><br \>
<input readonly type=text name="shipper3" size="50" maxlength="40" value="test3 - readonly"><br \>
<input readonly type=text name="shipper4" size="50" maxlength="40" value="test4 - readonly">
</td>
</tr>
</table>

---------------------------------------------------
Page #2:

<br \><br \><br \>
<div align=center>
<form method="post" action="./test.htm">
<table>
<tr>
<td>
<div>Enter New Shipper Info:</div>
<input type=text name="name1" size="50" maxlength="40"><br \>
<input type=text name="name2" size="50" maxlength="40"><br \>
<input type=text name="name3" size="50" maxlength="40"><br \>
<input type=text name="name4" size="50" maxlength="40">
</td>
</tr>

<tr>
<td align=right><input type=submit name="shipperSubmit" value="Submit"></td>
<tr>

</table>
</form>

<p><a href="javascript:self.close();">Close</a></p>
</div>

rocknbil

9:53 pm on Feb 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Completely possible as explained here [webmasterworld.com] and here [webmasterworld.com] by referencing the original window as the window.opener object.

Argblat

9:59 pm on Feb 18, 2005 (gmt 0)

10+ Year Member



Thank you very much for the link pointers. I am currently working on a solution which I will post in case any one stumbles across this thread in the future.

-Mike