Connecting Tech Pros Worldwide Forums | Help | Site Map

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

Audrius
Guest
 
Posts: n/a
#1: Sep 15 '05
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?


ASM
Guest
 
Posts: n/a
#2: Sep 16 '05

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


Audrius wrote:[color=blue]
> 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;[/color]

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;
[color=blue]
> 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?
>[/color]


--
Stephane Moriaux et son [moins] vieux Mac
Mick White
Guest
 
Posts: n/a
#3: Sep 16 '05

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


Audrius wrote:
[color=blue]
> 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;[/color]

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

Mick
[color=blue]
> 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?
>[/color]

Audrius
Guest
 
Posts: n/a
#4: Sep 16 '05

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


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

ASM
Guest
 
Posts: n/a
#5: Sep 16 '05

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


Audrius wrote:[color=blue]
> 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...[/color]

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 ?
[color=blue]
> So I guess IE doesn't work with array of options when trying to access
> them from another window. Am I right?[/color]

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


--
Stephane Moriaux et son [moins] vieux Mac
Audrius
Guest
 
Posts: n/a
#6: Sep 16 '05

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


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

Closed Thread


Similar JavaScript / Ajax / DHTML bytes