Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: accessing parent window of the modal dialog box ??  (Read 7627 times)

0 Members and 1 Guest are viewing this topic.

dmjpro

  • Guest
accessing parent window of the modal dialog box ??
« on: March 07, 2007, 02:36:38 AM »
i want to access the parent window (opener window) from a modal dialog box ....

can't i do that using window.opener from modal dialog box .....

i did it but i failed .... plz help me out ......

one guy from another forum answered me that it can be only done using .....
window.dialogArguments..... but my window.showModalDialog code already written... in many palces .....

how can i do that ......

thanx

Rob Pomeroy



    Prodigy

  • Systems Architect
  • Thanked: 124
    • Me
  • Experience: Expert
  • OS: Other
Re: accessing parent window of the modal dialog bo
« Reply #1 on: March 12, 2007, 06:26:56 AM »
Can you provide a link to the page in question please?  There is more than one way to create a modal dialogue box in javascript.
Only able to visit the forums sporadically, sorry.

Geek & Dummy - honest news, reviews and howtos

dmjpro

  • Guest
Re: accessing parent window of the modal dialog bo
« Reply #2 on: March 15, 2007, 03:27:09 AM »
sooryy for late response .....

my code is something like this ....

the JS code of parent window....

//Some code
window.showModalDialog(URL);

the JS code of modal dialog window

//Some code ...
here i want to access the parent window without sending the window_ref as dialog_wrgs
here i can't access the parent window using window.opener

here what should i insert code to access the parent window


plz help me out .. i m struggling out for a 10-15 days

thanxxxxxx in advance

Rob Pomeroy



    Prodigy

  • Systems Architect
  • Thanked: 124
    • Me
  • Experience: Expert
  • OS: Other
Re: accessing parent window of the modal dialog bo
« Reply #3 on: March 15, 2007, 04:21:45 AM »
The first thing you need to know is that showModalDialog() is not cross-browser compatible, and therefore its use should be avoided.  What you are attempting will not work in Firefox, for example.

That said, you are correct in thinking that this kind of modal dialog box does not automatically have access to the parent window.  You need to pass a reference to the parent like this:

Code: [Select]
window.showModalDialog( 'modalwindow.html', window, '');Then in the modal box you can use:

Code: [Select]
var parentwin = window.dialogArguments;
Only able to visit the forums sporadically, sorry.

Geek & Dummy - honest news, reviews and howtos

dmjpro

  • Guest
Re: accessing parent window of the modal dialog bo
« Reply #4 on: March 15, 2007, 04:45:24 AM »
our client uses the IE so there is no cross browser compatibility checking....

so without sending args from parent window i can't access the parent window anyway ....??? right.....

ok thanx for ur reply

Rob Pomeroy



    Prodigy

  • Systems Architect
  • Thanked: 124
    • Me
  • Experience: Expert
  • OS: Other
Re: accessing parent window of the modal dialog bo
« Reply #5 on: March 15, 2007, 06:17:58 AM »
Quote
so without sending args from parent window i can't access the parent window anyway ....??? right.....
That's certainly my understanding.  But as I said, there are other forms of (cross-browser compatible) modal dialogues that might provide more functionality.
Only able to visit the forums sporadically, sorry.

Geek & Dummy - honest news, reviews and howtos

dmjpro

  • Guest
Re: accessing parent window of the modal dialog bo
« Reply #6 on: March 15, 2007, 11:12:32 PM »
thanx for ur details .....

hellooo Rob Pomeroy if u r free then plz answer my question .... thanxx a lot for ur  guidance for a last three dayssss


have a good day

Rob Pomeroy



    Prodigy

  • Systems Architect
  • Thanked: 124
    • Me
  • Experience: Expert
  • OS: Other
Re: accessing parent window of the modal dialog bo
« Reply #7 on: March 16, 2007, 04:28:42 PM »
Quote
if u r free then plz answer my question
Okay.  Which question is that?
Only able to visit the forums sporadically, sorry.

Geek & Dummy - honest news, reviews and howtos

dmjpro

  • Guest
Re: accessing parent window of the modal dialog bo
« Reply #8 on: March 18, 2007, 10:45:06 PM »
actually what i post to this forums .....

have a good day

Rob Pomeroy



    Prodigy

  • Systems Architect
  • Thanked: 124
    • Me
  • Experience: Expert
  • OS: Other
Re: accessing parent window of the modal dialog bo
« Reply #9 on: March 19, 2007, 09:49:13 AM »
I think I've answered all the ones I've seen, that I can answer, but let me know if I missed one.  :)
Only able to visit the forums sporadically, sorry.

Geek & Dummy - honest news, reviews and howtos

dmjpro

  • Guest
Re: accessing parent window of the modal dialog bo
« Reply #10 on: March 19, 2007, 11:00:06 PM »
ok thanxxx