|
Subject:
|
Pop-Up Close / Refresh Parent
|
|
Posted By:
|
cmiller
|
Post Date:
|
10/16/2003 12:28:18 AM
|
Ok, here's a fun one. This question is really two fold.
#1, I have a pop-up submit window. I want to user to fill out that form and hit the submit button. When they hit that submit button, it will close the pop-up window (javascript:window.close()) and refresh the parent window. (javascript:window.refresh()) So how do I tell the pop-up to refresh the parent? I can get it to refresh itself, just not refresh the parent.
#2, Imagine this: There's a textbox with a drop-down menu just below it. I want the user to type things in the textbox, then select something from the dropdown and be able to add it to the textbox automatically by clicking on a link.. Say "insert"? That link will insert the value of the dropdown at the location of their cursor. Any ideas?
Thanks in advance.
---------- ~cmiller
|
|
Reply By:
|
richard.york
|
Reply Date:
|
10/16/2003 2:24:33 AM
|
For your first problem: To change the location/refresh the parent window you can use the opener property.
This one will change the href of the parent from the pop-up. window.opener.location.href = the_url;
The reload method will work too, This does a hard reload (returns forms to default values) The optional boolean conditional argument will if true make a new request of the server, if false it will attempt to pull the page from the cache. window.opener.location.reload(true);
If you want to preserve form data (soft reload), use the history method.
window.opener.history.go(0); '0' causes the page to reload, a negative value represents how many steps backward you'd like to go.
: ) Rich
::::::::::::::::::::::::::::::::: Smiling Souls http://www.smilingsouls.net :::::::::::::::::::::::::::::::::
|
|
Reply By:
|
joefawcett
|
Reply Date:
|
10/16/2003 2:27:33 AM
|
1) If you have opened by using window.open() then:
window.opener.location.reload(true);
If you have opened by window.showModalDialog then pass self as the second parameter and use:
window.dialogArguments.location.reload(true);
Probably better to put this before the close statement.
2) If the id of your listbox is "lstCountries" and the textbox has an id of "txtTown" then in your insert tag is:
<a href="/" onclick="addListboxValue();return false;">insert</a>
and you function is:
function addListboxValue()
{
var oLst = document.getElementById("lstCountries");
var oTxt = document.getElementById("txtTown");
oTxt.value += oLst.options[oLst.selectedIndex].text;
}
--
Joe
|
|
Reply By:
|
suki_icy
|
Reply Date:
|
4/14/2005 2:08:02 AM
|
for window.showModalDialog, we can use this also: window.dialogArguments.location = window.dialogArguments.location; (to avoid messagebox asking for Retry and Cancel with the message : "The page cannot be refreshed without resending the information again. Click Retry to resend the information. CLick Cancel.... ")
suki_icy =)
|
|
Reply By:
|
ramuis78
|
Reply Date:
|
6/30/2006 4:47:36 PM
|
I am facing the same probelm, can you please help me out? Here is my code.
Following code is to open popup window:
function OpenInstitutions(sURL) { var newwindow; newwindow = window.open(sURL,"Institutions","toolbar=no,location=no,scrollbars=yes,statusbar=no,height=600,width=870,resizable=yes"); if (window.focus) { newwindow.focus() } }
Following code is to close popup and refresh parent and focus.
function SaveSetting() { alert("Settings have been saved successfully."); var url = "CalInstitutions.aspx"; opener.location.reload(true); //opener.history.go(0); opener.focus(); self.close(); }
The above is working, but it is showing following alert message in parent window. "The page cannot be refreshed without resending the information again. Click Retry to resend the information. CLick Cancel.... ".
I appreciate your great help. Thanks in advance. ramuis78@hotmail.com
|
|
Reply By:
|
priyappated
|
Reply Date:
|
8/25/2008 7:03:35 AM
|
Hi I have a popup on popup close i am refreshing parent page but it is giving msgbox and when i click on retry then only my page is refreshed, is there any other way to refresh parent page.
|