Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Kinda New... Trying to refer to the "grandparent" window... 1

Status
Not open for further replies.

JavaStripped

Programmer
Dec 18, 2002
84
CA
I got into JS a few months ago, and all was going more or less well until I got to this point. I'm trying to send form textbox values back to the parent of the parent of the dialog box in IE5/6. The main web page has a dialog box (using
Code:
showModalDialog()
) that opens a second dialog box (using the same function) based on radio button value; this all works, but I can't get the form in the second dialog box to return its values to the main window. I tried nesting the
Code:
.opener
and
Code:
.parent
properties, but neither method seemed to work. The only other thing I can think of is to use DHTML methods and re-write the code of the single dialog box to play both roles, but I really don't want to go through that. Any assistance would be much appreciated.
 
i don't think this is how the modalDialog is supposed to work...are you even able to send data back to the main window from the first dialog?

the way they are intended to work is to send a return value:

var returnValue = window.showModalDialog(sURL [, vArguments] [, sFeatures]);

using this method, the second dialog would return a value to the first, which could return it to the main window.

=========================================================
if (!succeed) try();
-jeff
 
I got this working last weekend, finally; sorry it took me so long to update this. For those who are interested, I used the following method:

1: Create
Code:
<input type = &quot;hidden&quot;>
elements in the calling window(s), except the window that initiated the call (which I am assuming has
Code:
<input type = &quot;text&quot;>
elements that are being filled by the incoming data).

2: Write script to &quot;shuffle&quot; the data back to the main window, one window at a time, just as you would for a normal dialog/parent interaction, using the
Code:
<input type = &quot;hidden&quot;>
elements.

Make sure you set the
Code:
window.opener
property at each level.

Thanks again to jemminger for making me think (long and hard, as it turned out) about what I was doing and what I was trying to do, and for helping me toward the solution. JavaStripped
&quot;I did *not* escape. They gave me a day pass.&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top