By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,453 Members | 937 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,453 IT Pros & Developers. It's quick & easy.

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

P: n/a
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[i].text;
value = parent.window.opener.listValues.options[i].value;

self.document.form1.itemList.options[i] = 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?

Sep 15 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
ASM
Audrius wrote:
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[i].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[i].text;
var value = parent.opener.document.forms['myForm'].listValues.options[i].value;
value = parent.window.opener.listValues.options[i].value;

self.document.form1.itemList.options[i] = 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?

--
Stephane Moriaux et son [moins] vieux Mac
Sep 15 '05 #2

P: n/a
Audrius wrote:
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[i].text;
name = opener.document["FORMNAMEHERE"].listValues.options[i].text;

Mick
value = parent.window.opener.listValues.options[i].value;

self.document.form1.itemList.options[i] = 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?


Sep 16 '05 #3

P: n/a
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[i].

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

Sep 16 '05 #4

P: n/a
ASM
Audrius wrote:
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[i].

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[i].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[i].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
--
Stephane Moriaux et son [moins] vieux Mac
Sep 16 '05 #5

P: n/a
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

Sep 16 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.