[Zope] returning a selected object

Thomas B. Passin tpassin@mitretek.org
Fri, 13 Apr 2001 13:07:58 -0400


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