You are here: Re: Get value from popup window to parent window « HTML « IT news, forums, messages
Re: Get value from popup window to parent window

Posted by Davey on 09/06/05 18:23

"Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
news:uKlI$7usFHA.912@TK2MSFTNGP11.phx.gbl...
> Davey wrote:
>> I have a website which has a popup window (this only opens when the
>> user chooses to open it). In the popup window I have a <select>
>> control which lists a selection of "classes". Each class has a
>> description and a class_id (stored in the value attribute of each
>> option). The user will then select a class from the drop-down list.
>>
>> What I want to do is have a control in the parent browser window
>> which can store the class_id and the description that the user has
>> selected in the popup window.
>>
>> Any suggestions as to what control I should use in the parent window
>> and more importantly how I get the value from the popup window (this
>> must be client side code as the user will have entered other values
>> into the form in the parent browser window)?
>>
> This has nothing to do with ASP (you coulc be doing all of this with two
> .htm pages, so it's not an asp issue). You should follow up in a
> client-side
> scripting newsgroup such as m.p.scripting.jscript.
>
> The specific answer depends on how you are generating the popup window
> (openModalDialog? open?).

To be perfectly honest, I'm very rusty with client-side JavaScript. I'm not
even sure how I am going to open the popup, but I vaguely remember
previously generating a pop-up window (three years ago, the last time I had
to do it) in a fairly 'manual' way e.g. manually altering the window
properties.

> In general, most of these functions return a
> handle to the window that is being opened. You can use that handle to
> refer
> to objects in the new window. The new window will also have a reference to
> the parent window, either via an argument in the function used by the
> parent
> window to open it, or via its parentWindow property.
>
> The idea is to create what's called a "callback" function in the parent
> window. This function can be called by an event procedure (perhaps a
> button's onclick event) in the child window. When called it can use the
> handle returned by the function used to open the child window to enable it
> to read the properties of any controls in the child window and do whatever
> you want with them.

This sounds very interesting but would it work even though the user will be
filtering the contents of the popup window once it's open (i.e. getting
filtered data from the db server) - will the popup/function hold its state?

> The answer to the first question (what control to use in the parent
> window)
> depends on the use to which you want to put the values from the child
> form.
> Maybe a control isn't even needed, as global variables can be used.

The content of the child/popup window will be a form which will allow users
to filter for classes (because there could be thousands of them if left
unfiltered), and a form which will have a drop-down-box with classes in them
(i.e. the results of the filter). It is the value of this combo that I want
returned to the parent window using client side scripting.

> Again, follow up in a client-side newsgroup. If you reply to this, please
> remove the asp groups from the crosspost.

OK, thanks for the response.

> Bob Barrows
> PS. since they are not on the msnews server, I cannot reply to the
> alt.html
> or comp.lang groups in the crosspost, so I am leaving the asp groups in
> this
> post.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация