Forum Moderators: open
I am opening a modal window say MW1 from a page based on uses query and showing the data in it. Here the user has options to update some data. This data is stored in an array say MW2_ARR
In this window the user can click on a button to open another modal window say MW2 which also displays some other data set. This data is stored in an array MW2_ARR. The user can now choose the add this data set MW2_ARR with the original data set MW1_ARR.
Here I am doing "window.showModalDialog.opener.MW1_ARR" to access the parent dataset but its showing an error. That "window.showModalDialog.opener" is null or is not an object.
Can someone tell me whats wrong with my approach.
Thanks
this accesses the parent from the first window.
dialogArguments.MW1_ARR
I'm guessing from the 2nd window to the parent would be this?
da = dialogArguments
da.dialogArguments.MW1_ARR
[msdn.microsoft.com...]
- 2nd Modal to parent window
dialogArguments.dialogArguments.MW1_ARR
- 1st Modal opened from a framed page. 1st Modal opens 2nd. 2nd Modal to parent window
dialogArguments.dialogArguments.parent.MW1_ARR
Confused? I am :)
I think you'll find it easier to keep as much js in the parent as possible. Then it'll be all in one place, one step, and reusable.
parent
var MW1_ARR = ['array stuff',1]
var MW2_ARR = ['array stuff',2]
var name1_open = false;
var name2_open = false;// (window name, Modal or Modeless, source, width, height)
function MS_win(n, m, s, w, h) {
var w = window;
if (!w[n + '_open']) {
w[n + '_open'] = true;
w[n] = w['show' + m + 'Dialog'](s, w, 'dialogWidth:' + w + 'px; dialogHeight:' + h + 'px;')
} else {
w[n].focus()
}
}
parent.MS_win('name1', 'Modeless', 'page1.htm', 200, 200);alert(parent.MW1_ARR[1]);
// to Modeless
alert(parent.name1.document.title);
child windows
var da = dialogArguments;onunload = function() {
da.name1_open = false
}da.MS_win('name2', 'Modal', 'page2.htm', 200, 200);
alert(da.MW2_ARR[1]);
// Modeless to Modeless
alert(da.name2.document.title);
alert(da.name2_open);