Pop Up to pass back True/ False to Caller and close. Caller to reload itself if True.

I have an .asp program which launches a pop up window (window.open).
This new pop up allows the user to perform several functions.
For one of the functions, the pop up windows needs to return a true/ false bit indicating that function was used.
The .asp program needs to then interrogate the bit information, and if the function was used (True), the .asp program needs to reload itself.

Any help is very much appreciated........
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.

TimCotteeHead of Software ServicesCommented:

You can use something like:

if (confirm('Was it done?')) {window.opener.location.href=window.opener.location.href;}

In the onclick attribute of your button or link or whatever. This will cause the calling window to be refreshed, you don't even need to pass the flag back to it.

Tim Cottee
ODNTAuthor Commented:
Hi Tim,

Thank you for the quick response.   Your solution worked well for a similar problem I had in another area - Thank you.  

As for this problem, I should have been more descriptive.

The user will select functionality on the Pop Up window, which will then perform server-side database functions and send back results.  The Pop Up window will display the results and await the user closing it.

The utlimate solution is two fold.  

How do you keep the user focused on the Pop Up and disallow access to the Opener until the Pop Up is closed?

And secondly,  the Pop Up needs to send back a True/ False bit that the Opener will interrogate.   If True, the Opener should reload/ refresh itself.   (the reload process will remove the item with the href link on the Opener used to launch the Pop up with selected Database information).

Thanks again for the previous solution, it worked well in another area within this same piece of functionality.

TimCotteeHead of Software ServicesCommented:

As for making the opener window effectively disabled, this could be tricky if it is even possible. You could simply have an extra <div> element in the opening page that is normally hidden and shown when you launch the popup (hiding current visible elements at the same time) which would have the effect of stopping the user from doing anything in that window, except of course that they could always close it or navigate away from the page, though you could stop this in the onblur event. Not 100% guaranteed method though.

Your popup can set a value of a hidden element on the opener page easily using window.opener.document.getElementById('something').value = true; you could also have an onchange event linked to this element that will then do the necessary refresh.


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
ODNTAuthor Commented:

Thank you for the elegant (short) solution.   I used the first solution in an onunload event on the Pop Up <body> tag....  Worked like a charm.....

Thanks Again.....
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

From novice to tech pro — start learning today.