PDA

View Full Version : how to pass objects between parent and child windows?


usdunke
11-05-2002, 02:25 PM
I have an array of user defined objects in a parent window which I would like to pass to a child. Currently, the child window calls "window.opener.GetData()" and there is a function in the parent window which goes as follows:
"function GetData() { GetData = arrUserDefinedObjects }". I seem to be able to get the data to the child, but not in a format I can work with. If I alert the return value of the "window.opener.GetData()" statement in the child window, I get "[object Object]" but I can't get seem to reassociate the data with my class so that I may reference the fields.

Thanks in advance for any help.

beetle
11-05-2002, 09:19 PM
I need to see more code. What does GetData attempt to return?

krycek
11-05-2002, 10:49 PM
It looks to me like you may be forgetting that arrays and objects are passed "by reference" rather than "by value".

I am not sure if this is what is causing your problem, but it may be that you cannot pass an object this way. Maybe you will have to write a script to pass the array value by value, because it is possible that, due to only the reference being passed and the obejct not existing on the other "side" of the connection (i.e. in the parent window if passing from child to parent) it therefore cannot find the object being referenced.

Just a thought - but beetle is right, more code is required.

::] krycek [::