Refresh of parent window from child

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
LVL 1
runcsmeduncsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

intreegCommented:
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
SquareHeadCommented:
Maybe this?

<script language="JavaScript" type="text/javascript">
   window.opener.location.href='SomeOtherPage.html';
   window.opener.focus();
</script>
0
intreegCommented:
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
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

SquareHeadCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SquareHeadCommented:
agreed...
0
intreegCommented:
agreed... ( i am still hung up on the refresh the newly loaded page though... over anylitcal sometimes I am)
0
runcsmeduncsAuthor Commented:
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
runcsmeduncsAuthor Commented:
Thanks square

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

Appreciate it

Duncan
0
SquareHeadCommented:
thx for the A
0
runcsmeduncsAuthor Commented:
No worries

Thanks for the advice!
0
intreegCommented:
Ahhh it makes sense now, gj square!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.