Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 7th, 2005, 03:55 PM
Authorized User
 
Join Date: Dec 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default Open modal window and pass back url to parent

Hi,
I would like to open a modal window and pass back an URL to the parent page. Here is what I am trying to do without using Modal. How can I achieve this functionality with modal window?

Thanks..

This function is on the parent window.
-------------------------------------
function selUser() {
    var winl = (screen.width - 300) / 2;
    var wint = (screen.height - 600) / 2;
    var url = "testUser.asp";
    winDimentions = 'height=' + 500 +', width=' + 400 + ',top=' + wint + ',left=' + winl ;
    var styleWin = window.open (url, 'styleomattic', 'toolbar=0,location=no,directories=0,status=0,menu bar=0,scrollbars=1,resizable=1,' + winDimentions);
    styleWin.focus();
}
-----------------------------------------
This function on the child window.
---------------------------------
        function setUser(UID, sUName) {
               var url = "testUser.asp?SUID=" + UID;
        window.opener.location.href = url;
        window.self.close();
        return false;
    }



 
Old April 7th, 2005, 07:49 PM
Authorized User
 
Join Date: Apr 2005
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

http://www.codestore.net/store.nsf/u...Q?OpenDocument

In a world of give and take, take all you can and you die with nothing. Give all you can and you die with honor.
 
Old April 8th, 2005, 01:02 PM
Authorized User
 
Join Date: Dec 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
Thanks for your reply. This code is working fine but when I click the link on the child window it's refreshing the parent page as well as opening the new window.What could be the problem?

On the parent window I changed the 'field.value' to 'self.location.href' to refresh the parent with new url.

Thanks..

 
Old March 23rd, 2010, 08:03 AM
Authorized User
 
Join Date: Jan 2010
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to elizas
Default Refresh parent page on closing modal child window/popup

You cannot write a javascript function to refresh parent page from a Modal child pop-up window.

Instead, you can put the code to refresh the page just below the line that actually opens the modal popup in the parent page. Since code exceution on parent stops at the point when the modal pop window is opened, the next line is executed only after the modal popup has been closed. So if you put the reload call just below the call to open modal popup, the parent would refresh immediately the modal popup is closed.

Example - To refresh parent page on closing Modal child pop-up window.

....on Parent page

function OpenModalPopUP()
{
window.showModalDialog('page.aspx');
window.location.reload();
}
__________________
Cheers,
Eliza

Mindfire: India's Only Company to be both Apple Premier & Microsoft Gold certified.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Centering Popup window & Blur Parent window jkusmanto Javascript How-To 0 May 25th, 2007 03:19 AM
Referencing parent page from modal dialog gp_mk HTML Code Clinic 25 April 19th, 2007 01:28 PM
Forcing postback on parent page from modal dialog gp_mk ASP.NET 1.0 and 1.1 Professional 8 February 20th, 2007 12:44 PM
closed parent window when opened child window jaiwin Javascript How-To 0 October 8th, 2006 12:54 PM
Close Parent window on opening child window pkdev Javascript How-To 8 April 11th, 2004 12:06 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.