PDA

View Full Version : Trouble With Window.Opener


jivinivan
07-12-2007, 03:57 PM
I'll try to make this as clear as possible

I have a WYSIWYG editior on my website. It has a link "maker". I also have a place on the site where they can upload pdfs, videos, etc. On my link maker i have a browse button which opens a popup with a list of all of their files they uploaded. When they select one and click insert it is supposed to write the URL to the URL field of the link maker, but it writes it to the first field on the parent window.

Here's how it works

Mainpage(main editor and button for the link maker popup)
-----GOES TO-----
Link Maker(Has A URL Field with a browse button for the file browser)
-----GOES TO-----
Browser(Shows list of files)

Here is my code for the insert button
onClick="self.opener.document.forms[0].elements[0].value = self.document.elementform.link.value;window.close();"

I have also tried window.opener they both do the same thing

glenngv
07-12-2007, 05:02 PM
It's filling out the first field because you tell it to do so.
onClick="self.opener.document.forms[0].elements[0].value = self.document.elementform.link.value;window.close();"
Just specify the name of the target field.
onClick="self.opener.document.forms[0].nameOfTargetField.value = self.document.elementform.link.value;window.close();"