1

I have a page that opens a modal dialog. After the operations done on dialog I want to refresh the opener page. But when I open the popup by using "openDialog" I cannot access to the opener by using window.opener on popup page. It appears "undefined" when I wanted to access. (I dont want to use "popup" method in this case. I want it to be a dialog by the way. using "popup" is my second plan.)

What is the best practice to get rid off this issue?

Ali Ersöz
  • 15,860
  • 11
  • 50
  • 64

5 Answers5

3

Modifying parent data from modal dialog

Refresh parent window from modal child window

rahul
  • 184,426
  • 49
  • 232
  • 263
1

this was what i need that i got from the link

In the parent:

parentVar = "set by parent";
vRv = window.showModalDialog("modalWindow.html",window.self, "");

In the modal:

dialogArguments.parentVar = "set by modal";

PS: Dont forget to set reference to opener with "window.self"

Ozan BAYRAM
  • 2,780
  • 1
  • 28
  • 35
0

a modal dialog box is a blocking function. the caller waits until the box is closed, then resumes. Therefore, it is a simple matter of doing the refresh in the script of origin AFTER the call to open the dialog.

For example, let's say you have a page with a grid. You've got an add button to open a modal dialog, and you need the grid to refresh itself (or refresh the page, the problem is the same).

HEre's pseudo code to open modal dialog, then refresh the grid

replace grid.Refresh(); with whatever action you want to happen, it will execute AFTER the dialog box is closed.

KenF
  • 122
  • 5
0

When i use Shadowbox i can access this.

self.parent.location.reload();

Perhaps this works for you also.

Ólafur Waage
  • 68,817
  • 22
  • 142
  • 198
0

if you look at https://developer.mozilla.org/En/DOM/Window.openDialog you'll see that you can make the dialog box modal by passing the modal argument through, that way it wont return until the dialog is finished, at that time you can reload parent page.

John Boker
  • 82,559
  • 17
  • 97
  • 130