473,395 Members | 1,422 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Getting action info from popup to main window

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
Jun 27 '08 #1
3 1880
On Jun 26, 3:03*pm, DrKen <javaje...@yahoo.comwrote:
* *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.

Jun 27 '08 #2
On Jun 26, 12:06 pm, Tom Cole <tco...@gmail.comwrote:
On Jun 26, 3:03 pm, DrKen <javaje...@yahoo.comwrote:
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
Jun 27 '08 #3
SAM
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
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Noozer | last post by:
When using the WebBrowser control, is it possible to cause popup windows to appear within the WebBrowser control itself instead of a new window? This is what I've written in the NewWindow2 event,...
2
by: Bill S. | last post by:
Hey, I am trying to figure this out. The hyperlinks on my page open up a small popup window. I have no reason to refresh the parent page or what have you. I was living in a very happy world,...
3
by: NeverLift | last post by:
But, if it's not open, I don't want to open it . . . using window.open will open it if it doesn't exist, even if the url in that open is null (the window is then empty -- but it's open). The...
3
by: MEM | last post by:
Hello, I'd like to refresh the main or top most browser window from a child window. Specifically, child popup A is opened by a main browser window then child popup B is opened from within child...
4
by: Davey | last post by:
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...
5
by: Jay | last post by:
I have a situation where the user clicks on a button in a DataGrid to launch a popup window via javascript. In the popup window the user does some things that result in changes to the underlying...
1
by: nadig.umesh | last post by:
Hi, I have window 1 from which i launch window 2 Window 2 remains open showing page 1 In window 2, i navigate from page 1 to page 2 Window 1 tries to launch window 2 once again Currently,...
4
by: Bosconian | last post by:
I have created a form tool page that consists of several dropdowns which allows a user to drill down and select a desired document for viewing in an external window. I need to post the form data to...
3
by: Jimmy | last post by:
It is also possible for popup window to call function in main window by using the opener property. Will "opener.someFunctionInMain(param1, param2)" in the popup window work? It's possible for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.