File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes post data from one window to another Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "post data from one window to another" Watch "post data from one window to another" New topic
Author

post data from one window to another

John Schretz
Ranch Hand

Joined: Sep 10, 2008
Posts: 188
Not sure how to go by this but what i want to do is have my page A with a link on it that pops up another window B to choose some data with checkboxes. then click an ok button and have that data then displayed on page A
is this possible to do?
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
In the popup window, you can access the parent window which opened the popup window using the window.opener property in JS.
John Schretz
Ranch Hand

Joined: Sep 10, 2008
Posts: 188
can this be done using the post method for forms?

this will pop the window but now i need to post data from that window back to the original page

John Schretz
Ranch Hand

Joined: Sep 10, 2008
Posts: 188
Since the other topic is locked

The issue is the same -- use the opener reference to access the opening page. Please continue any further discussion in the original topic.


how would i go by doing this. I have searched the net but i cant find a good example and my JS skills are not that great.

thanks
john
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60755
    
  65

Just backing up a step: why the popup in the first place? Very old-school and makes things dicey trying to keep two windows in sync. I rarely use them nowadays. I'd consider alternative approaches if it were me.

The opener reference "points" to the window instance of the opening window. You can reference anything defined on that instance -- top-level functions, for example.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
John Schretz
Ranch Hand

Joined: Sep 10, 2008
Posts: 188
Bear Bibeault wrote:Just backing up a step: why the popup in the first place? Very old-school and makes things dicey trying to keep two windows in sync. I rarely use them nowadays. I'd consider alternative approaches if it were me.

The opener reference "points" to the window instance of the opening window. You can reference anything defined on that instance -- top-level functions, for example.


well here is what i am trying to do. i have a screen that i am creating discount codes for a website. it will be like spend X amount and get X amount off. however when creating these codes i will have item and brand exclusions. i have 2 tables on that screen that will have the list of brands and items to exclude in the discount. i want to pop a search item and search brand picker so i can pick and choose which items and brands will be excluded then apply them to the main screen. The user may do this multiple times as they may exclude many different items and brands.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
John Schretz wrote:
how would i go by doing this. I have searched the net but i cant find a good example and my JS skills are not that great.

Then start learning JS and HTML DOM. The w3schools.com site provides nice tutorials and references.

http://www.w3schools.com/JS/default.asp
http://www.w3schools.com/HTMLDOM/default.asp
http://www.w3schools.com/htmldom/prop_win_opener.asp
 
Don't get me started about those stupid light bulbs.
 
subject: post data from one window to another
 
Similar Threads
HttpSession Object creation with mulitple browser windows
Pop-Up Window and getParameter()
opening a new window from servlet
Reloading Calling Page
not to allow closing current window..