Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

post data from one window to another

 
John Schretz
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
John Schretz
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic