michaellunsford Posted February 3, 2007 Share Posted February 3, 2007 I have a popup form with another popup to select a value for one field. It's late, so I hope I can explain this where it makes sense. WYSIWYG Editor is popping up "insert image" form dialogue. There is an upload image button that fires yet another popup window with upload dialogue. Trying to pass a value to the "insert image" window's "URL" field from the "upload image" popup. Instead of pointing to the actual calling window (insert image), "window.opener.document.forms[0]" is actually pointing to the WYSIWYG editor window's forms[0]. What to do? Quote Link to comment Share on other sites More sharing options...
mainewoods Posted February 4, 2007 Share Posted February 4, 2007 the 'window.opener' can also be used to run a function in the opening window: window.opener.somefunction(); maybe you pass a function in the opener the datavalue to pass, the window name to pass it to, and the form/field name in that window to 'push' it in: window.opener.pushvalue(towindowname, toformname, tofieldname, datavalue); the pushvalue() function would contain code to actually 'push' the datavalue into the specified window/field. I think you have to store the window.open in a var: var shoppingWin = window.open('','shoppingWin','width=400,height=300,scrollbars=1'); if(shoppingWin.focus) { shoppingWin.focus(); } //altering child window! Quote Link to comment Share on other sites More sharing options...
michaellunsford Posted February 4, 2007 Author Share Posted February 4, 2007 ugh the parent window has a function that pushes data to the second window: win.document.getElementById('prev').innerHTML = '<img src="' + (win.document.forms[0].elements[field_name].value) + '" />'; the code works great when called from the same window, but gives a "win.document has no properties" error when called from the third window. Quote Link to comment Share on other sites More sharing options...
michaellunsford Posted February 4, 2007 Author Share Posted February 4, 2007 [code]wow, what a beating... second window: window.opener.myvar=window.self;[/code] first window function: myvar.document.getElementById..... Thanks for the help, it was a shove in the right direction and I couldn't have figured it out otherwise. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.