From: DrKen on
I need to have a user be able to click a link or button that brings
up a popup window. When the user selects an item from the drop down
list on the popup window (should I require only a click of the item or
clicking a separate button like "continue"?), I need the selection to
show up in a text field on the main page. Yet, so far as I can tell,
window.open() has no way to return any value. So how can I do this
please? I'm sure it's a common thing to do. I see calendar popups do
this all the time. Thanks.

Ken
From: Tom Cole on
On Jun 26, 3:03 pm, DrKen <javaje...(a)yahoo.com> wrote:
>    I need to have a user be able to click a link or button that brings
> up a popup window.  When the user selects an item from the drop down
> list on the popup window (should I require only a click of the item or
> clicking a separate button like "continue"?), I need the selection to
> show up in a text field on the main page.  Yet, so far as I can tell,
> window.open() has no way to return any value. So how can I do this
> please? I'm sure it's a common thing to do. I see calendar popups do
> this all the time.  Thanks.
>
> Ken

You can call window.opener.<function_name>.

For example in your parent window you have a method named:

setSelection(selection) {
//do something with selection value...
}

Then in your popup window you can call:

var value = document.getElementById("someID").value;
window.opener.setSelection(value);

HTH.

From: DrKen on
On Jun 26, 12:06 pm, Tom Cole <tco...(a)gmail.com> wrote:
> On Jun 26, 3:03 pm, DrKen <javaje...(a)yahoo.com> wrote:
>
> > I need to have a user be able to click a link or button that brings
> > up a popup window. When the user selects an item from the drop down
> > list on the popup window (should I require only a click of the item or
> > clicking a separate button like "continue"?), I need the selection to
> > show up in a text field on the main page. Yet, so far as I can tell,
> > window.open() has no way to return any value. So how can I do this
> > please? I'm sure it's a common thing to do. I see calendar popups do
> > this all the time. Thanks.
>
> > Ken
>
> You can call window.opener.<function_name>.
>
> For example in your parent window you have a method named:
>
> setSelection(selection) {
> //do something with selection value...
>
> }
>
> Then in your popup window you can call:
>
> var value = document.getElementById("someID").value;
> window.opener.setSelection(value);
>
> HTH.

Thanks. I was about to post an addendum. The main page has three
fields that are essentially identical:
Prior School 1:...................
Prior School 2:...................
Prior School 3:...................

If the person clicks on a button to find the school for the first of
these three, I need to fill in the first of the three. If the person
clicks on the third box's link for the popup, I need to have the third
row populated. Is there a way to do this without having to create
three separate popup windows? Thanks.

Ken
From: SAM on
DrKen a �crit :
>
> Thanks. I was about to post an addendum. The main page has three
> fields that are essentially identical:
> Prior School 1:...................
> Prior School 2:...................
> Prior School 3:...................
>
> If the person clicks on a button to find the school for the first of
> these three, I need to fill in the first of the three. If the person
> clicks on the third box's link for the popup, I need to have the third
> row populated. Is there a way to do this without having to create
> three separate popup windows? Thanks.

certainly, you can send in the same poppup all what you want, info 1 of
school 1, info 3 of scholl 3 etc

function pop(page) {
// if popup doesn't exist or is closed
if(typeof truc == 'undefined' || truc.closed)
truc = window.open('','','width=300,height=400'); // create it
truc.location = page; // load in it the asked file
truc.focus(); // bring it to front
}

In the file loaded in the popup

<form
action="javascript:opener.document.form1.school_2.value=this.choice.value;opener.focus()">
Choose an option for School #2 : <select name="choice">
<option value="1"> first
<option value="2"> second
</select><input type=submit>
</form>


That would have to work too with tabs
--
sm