Problem with params between parent and popup windows using IE (everything's fine with Firefox)

A

Audrius

Hello everybody,

I have one page with <select> list in it, which opens a popup with
another <select> list. Those two list are linked... When I select
something in the list that is in popup window and confirm the selection
(by pressing button), I call a function that fills the "parent" window
and forces popup to close. All this is accomplished by directly
accessing another list:

for(var i = 0; i <= selLength; i++){
name = parent.window.opener.listValues.options.text;
value = parent.window.opener.listValues.options.value;

self.document.form1.itemList.options = new Option(name, value);
}

And this doesn't seem to work with IE. With Firefox is OK.

Any ideas how to make it work with IE?
 
A

ASM

Audrius said:
Hello everybody,

I have one page with <select> list in it, which opens a popup with
another <select> list. Those two list are linked... When I select
something in the list that is in popup window and confirm the selection
(by pressing button), I call a function that fills the "parent" window
and forces popup to close. All this is accomplished by directly
accessing another list:

for(var i = 0; i <= selLength; i++){
name = parent.window.opener.listValues.options.text;


where and what is this 'listValues'

if it is a select (in a form) named 'listValues' ->
try (as you do in your popup) :

var name = parent.opener.document.forms['myForm'].listValues.options.text;
var value = parent.opener.document.forms['myForm'].listValues.options.value;
value = parent.window.opener.listValues.options.value;

self.document.form1.itemList.options = new Option(name, value);
}

And this doesn't seem to work with IE. With Firefox is OK.

Any ideas how to make it work with IE?
 
M

Mick White

Audrius said:
Hello everybody,

I have one page with <select> list in it, which opens a popup with
another <select> list. Those two list are linked... When I select
something in the list that is in popup window and confirm the selection
(by pressing button), I call a function that fills the "parent" window
and forces popup to close. All this is accomplished by directly
accessing another list:

for(var i = 0; i <= selLength; i++){
name = parent.window.opener.listValues.options.text;


name = opener.document["FORMNAMEHERE"].listValues.options.text;

Mick
value = parent.window.opener.listValues.options.value;

self.document.form1.itemList.options = new Option(name, value);
}

And this doesn't seem to work with IE. With Firefox is OK.

Any ideas how to make it work with IE?
 
A

Audrius

Thanks for replies...

None of the previously mentioned solutions work for me. The most
annoying thing is that using: "parent.window.opener.listValues.length"
I can still get the correct length. But I cannot access any element
using options.

alert(parent.window.opener.listValues.options) returns "[object]". So
it's not void or undefined...

For now I've completed this communication with a text area in the
parent window and selection list in my popup. But my solution is a
little straraightforward, because in this case I need to store
element's value and name in my text area (I cannot simple store names,
because I need them when opening the same popup for editing purposes).
And each time a popup loads, it parses the value of text area and forms
options that are inserted into popup's selection... huh...

So I guess IE doesn't work with array of options when trying to access
them from another window. Am I right?

Audrius
 
A

ASM

Audrius said:
Thanks for replies...

None of the previously mentioned solutions work for me. The most
annoying thing is that using: "parent.window.opener.listValues.length"
I can still get the correct length. But I cannot access any element
using options.

alert(parent.window.opener.listValues.options) returns "[object]". So
it's not void or undefined...


and ...

for(var i = 0; i <= selLength; i++){
alert('index = '+i+'\nvalue = '+parent.window.opener.listValues.options.text)
}

or (with 'myForm' as name of form in opener) :

for(var i = 0; i <= selLength; i++){
alert('index = '+i+'\nvalue = '+opener.document.myForm.listValues.options.text)
}

what does that say ?
So I guess IE doesn't work with array of options when trying to access
them from another window. Am I right?

IE is not very clever but not to this step I hope
 
A

Audrius

At last! Thanks for you help...

I finally managed that. The problem was as I imply with frames. My
popup window had two iframes within it (that's why I was using parent
identifer). And none of those frames could directly "communicate" to
the list's options in my parent window. So I solved this by adding a
method to my parent window (addItem(position, name, value)) and adding
few methods to my popup's top frame, which retrieves name and value
variables of my preferred option.

Thanks one more time!

Case is closed.
Audrius
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top