two windows, sending data between....
Moderator: General Moderators
two windows, sending data between....
Sorry if I missed something, but after a little searching and googleing I was unable to find the answer:
I have one page that has few add [something] buttons. When user presses the button it opens new window, where user can select something from a list and when he/she presses ok the newer window should close, and changes should be updated to the main window.
The story so far: I happily made script to open new window, and controls to that new window.
Problem:
How can I tell the main window to update it self after user has pressed ok (the new window ok button, values are in session, so only refresh is required..) Also how can I now close the new window?
Thanks,
-9902468
I have one page that has few add [something] buttons. When user presses the button it opens new window, where user can select something from a list and when he/she presses ok the newer window should close, and changes should be updated to the main window.
The story so far: I happily made script to open new window, and controls to that new window.
Problem:
How can I tell the main window to update it self after user has pressed ok (the new window ok button, values are in session, so only refresh is required..) Also how can I now close the new window?
Thanks,
-9902468
You could reload the main window with http-meta-refresh periodically, but that won't really solve your problem.
Another solution: The new window sends the information to the old window and closes itself...
Another solution: The new window sends the information to the old window and closes itself...
Code: Select all
/* mainwindow.php */
if($go='ok') echo 'case 1';
else echo 'case 2 <input type="submit">"; /* This button opens the newwindow */
/* newwindow.php
<form action="mainwindow.php">
<input type="submit" name="go" value="ok"> <!-- This button sends all information to the main window (look at the form action) -->
</form>I thought that
just loads somepage.php file to THIS window? (where the form tag is)
Code: Select all
<form action=somepage.php>You're right.9902468 wrote:I thought that
just loads somepage.php file to THIS window? (where the form tag is)Code: Select all
<form action=somepage.php>
I thought that would'nt matter.
Well, I'm sorry, but I don't know any JS.
yes there is a way, look up javascript and passing variables from one browser to the next, im pretty sure it can be done, its even done (something similar) on this forum, when you click on VIEW MORE EMOTICONS, where you select an emoticon from a remote window, and it adds it to the main window's Message Body. So you could just call a function in the main window from the Remote window and the function would refresh the page.
Hope this helps.
Hope this helps.
- Johnm
- Forum Contributor
- Posts: 344
- Joined: Mon May 13, 2002 12:05 pm
- Location: Michigan, USA
- Contact:
Try this:
In the parent page add:
In the child page add:
add this to the bottom of the child page:
Direwolf
In the parent page add:
Code: Select all
<input type="hidden" name="var_name">Code: Select all
<script>
function SubmitToParentPage(form)
{
window.opener.document.formsї0].var_name.value=
form.child_page_var.value;
form.submit();
window.close();
}
</script>Code: Select all
<input type="button" value="Submit"
onClick="SubmitToParentPage(this.form)">boooooya...
try this:
PARENT WINDOW CODE
REMOTE WINDOW CODE

PARENT WINDOW CODE
Code: Select all
<script language="JavaScript">
<!--
function new_window() {
self.name = "Parent_Window";
var new_window = "scrollbars,resizable,width=250,height=150,left=700,top=25";
OpenWindow = window.open("remote.htm", "remote", new_window);
}
function refresh_window() {
window.location.reload( true );
}
-->
</script>
<a href="javascript:onClick=new_window();">Open Remote Window</a>Code: Select all
<a href="javascript:refresh_window();" target="Parent_Window" onClick="window.close()">Refresh main window and Close this remote.</a>