?
Solved

Refresh of parent window from child

Posted on 2004-11-30
11
Medium Priority
?
1,094 Views
Last Modified: 2008-02-01
Hello.

When the user clicks on the OK button in my child form it runs this piece of javascript

<script language="JavaScript" type="text/javascript">opener.location.reload(true);close();</script>

this works fine if i want to refresh the page that the popup was lauched from.

Is it possible to pass control back to the parent form and still do a refresh but specifying the url that is to be refreshed?

Thanks for any help

Duncan
0
Comment
Question by:runcsmeduncs
  • 4
  • 4
  • 3
11 Comments
 
LVL 5

Expert Comment

by:intreeg
ID: 12708388
I am a little confused... to specify the URL to be refreshed would be to load a different page... right? I am not sure what you are trying to accomplish, please post more info. Why do you open a pop-up to refresh the opener and then close the pop-up?
0
 
LVL 18

Expert Comment

by:SquareHead
ID: 12708744
Maybe this?

<script language="JavaScript" type="text/javascript">
   window.opener.location.href='SomeOtherPage.html';
   window.opener.focus();
</script>
0
 
LVL 5

Expert Comment

by:intreeg
ID: 12708841
I agree with square head if you are trying to load a different page but if you need to load a different page and then reload the page you would need to add
window.opener.location.reload(true);

However, I am still not sure why you would want to reload a page after loading a new one. Maybe I am just hung up on vocab...

"...do a refresh but specifying the url that is to be refreshed..."

I think squarehead interupted it as simply loading a new page which is what should happen in my opinion, cannot think of why you would want to refresh the page after it just loaded.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 18

Accepted Solution

by:
SquareHead earned 200 total points
ID: 12708861
Actually this works:

Parent.htm:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
      <title>Parent</title>

<script language="JavaScript" type="text/javascript">
<!--

function window_open()
{
var newWindow;
var urlstring = 'child.htm'
newWindow = window.open(urlstring,'','height=200,width=280,toolbar=no,minimize=no,status=yes,memubar=no,location=no,scrollbars=no')
}

// -->
</script>
</head>

<body>
<a href="#" onClick="window_open();return false;">Open new window</a>
</body>
</html>




Child.htm:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
      <title>Child</title>

<script language="JavaScript" type="text/javascript">
function parentChangeHREF()
{
   window.opener.location.href="http://www.google.com";
   window.opener.focus();
}
</script>


</head>

<body>
<button onclick="parentChangeHREF();">OK</button>


</body>
</html>
0
 
LVL 18

Expert Comment

by:SquareHead
ID: 12708875
agreed...
0
 
LVL 5

Expert Comment

by:intreeg
ID: 12708934
agreed... ( i am still hung up on the refresh the newly loaded page though... over anylitcal sometimes I am)
0
 
LVL 1

Author Comment

by:runcsmeduncs
ID: 12713629
I know my logic seems pretty warped but bare with me and i will try and explain.

My form contains several rows of data that is stored in an Oracle Database. When the screen is first rendered the order of the rows are set a default of the row ID. There is a hyper link on this page which when clicked opens up a popup allowing the user to change the order of the rows i.e. by name, location etc.

If they change the order and click ok in the child popup window, I need to go back to the parent page and refresh but I also need control of the URL that is submitted at this stage.

Hope that makes sense!!

Duncan
0
 
LVL 1

Author Comment

by:runcsmeduncs
ID: 12714127
Thanks square

I know my requirement was a bit strange but that worked like a dream!!!

Appreciate it

Duncan
0
 
LVL 18

Expert Comment

by:SquareHead
ID: 12715312
thx for the A
0
 
LVL 1

Author Comment

by:runcsmeduncs
ID: 12715340
No worries

Thanks for the advice!
0
 
LVL 5

Expert Comment

by:intreeg
ID: 12717297
Ahhh it makes sense now, gj square!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Suggested Courses
Course of the Month16 days, 14 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question