Hi, Does anybody knows how to open a popup window, let the user choose something out of a list and return this value back to the form which opened the popup window? Thanks in advance, Tom.
On Fri, 13 Apr 2001, Tom Deprez wrote:
Does anybody knows how to open a popup window, let the user choose something out of a list and return this value back to the form which opened the popup window?
Easy. Javascript. I did it hunderds times. (But discussing JS is OT here :) Oleg. ---- Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
you can use something like this: <a href=# onClick="window.open('method?z_var=<dtml-var z_var>)> where method is the name of the dtml file you want the window to display. this example also includes a variable and value passed to the window. if you want the value selected from the opened window to be passed back to the calling method, you will need to set up a default variable that will then get changed when you press the submit button in the window. then the original calling method will redraw itself to reflec the value. hth. ciao! greg. Gregory Haley DBA/Web Programmer Venaca, LLC.
Hi,
Does anybody knows how to open a popup window, let the user choose something out of a list and return this value back to the form which opened the popup window?
Thanks in advance,
Tom.
Tom Deprez asks
Does anybody knows how to open a popup window, let the user choose something > out of a list and return this value back to the form which opened the popup window?
You have two approaches. 1) The popup sends its values back to the parent browser window, which means it has to know the name of the parent. You use javascript to accomplish this. You can get a handle to the parent window by a javascript call from the parent after the popup initializes. Or 2) The popup submits a form with the selection to the server, and the target of the form is set to the original browser window (which likewise has to be named with a known name). The new page from the server replaces the original page. I recommend 1). Make sure, though, that the popup javascript checks for the existence or success of its calls to the parent, just in case the user closes the parent before the popup does its work. Cheers, Tom P
Does anybody knows how to open a popup window, let the user choose something > out of a list and return this value back to the form which opened the popup window?
You have two approaches.
1) The popup sends its values back to the parent browser window, which means it has to know the name of the parent. You use javascript to accomplish this. You can get a handle to the parent window by a javascript call from the parent after the popup initializes. Or
How can I send values to the parent browser window? Do you mean reloading the parent page and sending the values with the url?
2) The popup submits a form with the selection to the server, and the target of the form is set to the original browser window (which likewise has to be named with a known name). The new page from the server replaces the original page.
Tom.
Tom Deprez wrote:
How can I send values to the parent browser window? Do you mean reloading the parent page and sending the values with the url?
You can send it directly to the form variable. Try this: http://developer.netscape.com/docs/manuals/communicator/jsguide4/index.htm I found it rather useful. -- Tim Cook, President - FreePM,Inc. http://www.FreePM.com Office: (731) 884-4126 ONLINE DEMO: http://www.freepm.org:8080/FreePM
Tom Deprez wrote:
Hi,
Does anybody knows how to open a popup window, let the user choose something out of a list and return this value back to the form which opened the popup window?
Thanks in advance,
Tom.
This is done using javascript: Calling (parent) page code: <script type="text/javascript"> <!-- function popUpWindow(url) { w = window.open(url, 'popup', "left=30,top=30,width=550,height=470,menubar,toolbar,scrollbars,status,location"); w.focus(); } //--> </script> <form name="parent_form"> <input type="text" name="parent_field" /> <input type="button" onclick="popUpWindow('<Pop up page URL>')" value=" Select " /> </form> Pop up page: <script type="text/javascript"> <!-- function returnSelection(list) { opener.document.parent_form.parent_field.value = list[list.selectedIndex].value; window.close(); } //--> </script> <form> <select name="list" size="10"> <Put your options here> </select> <input type="button" onclick="returnSelection(this.form.list)" value=" OK " /> </form> hth, -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
participants (6)
-
Casey Duncan -
ghaley@mail.venaca.com -
Oleg Broytmann -
Thomas B. Passin -
Tim Cook -
Tom Deprez