wood burning stoves*
The moose likes HTML, CSS and JavaScript and the fly likes Popup to parent communications Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Popup to parent communications" Watch "Popup to parent communications" New topic
Author

Popup to parent communications

rose hegde
Ranch Hand

Joined: Oct 22, 2003
Posts: 40
I have a form:
form name is "name" ...it has a link which opens a popup window to search names from the database starting from any alphabet...
in the popup window ..user will key in values and hit "search" and it will post to itself with the search results. And from the resulting values, user will select one from the drop-down list. I want that selected value passed back to name with the details of the repective name.
Till now i am successful in opening a popup window and searching names from the database and it also lists in drop down list retrieving from database.
But when i click a particular name and click on submit all the values get displayed on the same window ...whereas i want the popup window to close and details to display on main window...!!..All this is done in jsp..!!
I would be grateful to anyone who helps me...since i am trying this very hard...
[ November 19, 2003: Message edited by: Bear Bibeault ]
jyothsna kumari
Ranch Hand

Joined: Jul 21, 2003
Posts: 108
hai,
before submiting the child window you close the window using self.close and then submit.do the necessary things in the class and then redirect to the main page,which you want to show the results.hope i am clear,or pls let me know.
jyothsna
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60780
    
  65

The actions of communicating between the popup window and its parent, as well as closing the popup, must be performed on the client side through the use of Javascript. As such, I'm moving this along to the HTML/Javascript forum.
I also changed the topic subject to something more appropriate. (rose, your posts will get more attention if you give them meaningful subjects)
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
rose hegde
Ranch Hand

Joined: Oct 22, 2003
Posts: 40
I am sorry but i did not get it...pls tell in detail.
Thanx
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60780
    
  65

Within your popup, you have access to the parent window through the opener variable. You can use this access to cause actions to happen within the parent from your popup. If you need a reference, I highly recommend this book.
Try your hand at writing some code to perform the operations you are after and we'll all be glad to help you with the points you are getting stuck on.
bear
[ November 19, 2003: Message edited by: Bear Bibeault ]
rose hegde
Ranch Hand

Joined: Oct 22, 2003
Posts: 40
I have tried a lot and i am stuck ...From a jsp page i call a popup window...which has a search field...where in i enter amy alphabet and names starting from that letter get displayed in a list box...when i click on a particular name and press submit...all the details of that name get displayed on the same popup page where as i want to display it in the main page...How to pass the value thru a submit button from popup window to main window..!!???
PS : If i search a full name and when only one name is displayed...thru the help of a href link...i wrote a function loadinparent and that name values are all displayed in the main window..In this case its not working if there r more than one name in the list...!!!
Now can u help me?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60780
    
  65

We probably need to see the code that you have already written to understand where you want to take this.
Unfortunately, starting tomorrow I'm am going to be out-of-touch for about a week... but there are a lot of smart people who post in this forum and should be able to help you along... you just need to show what you've got so far, and describe what's not working for you.
And here's a nudge in the right direction: you cannot submit a request to the popup and expect the results to appear in the parent. You must submit to the parent in the first place if that's where you are expecting the response. You should examine exactly where your processing is occuring, and make sure that it's targetted at the appropriate window.
bear
[ November 20, 2003: Message edited by: Bear Bibeault ]
rose hegde
Ranch Hand

Joined: Oct 22, 2003
Posts: 40
I am posting the code...u r here today and u can help me today...Pls..
My first page is...
emp_update.jsp
---------------------

------------------
Now when i press submit.(or by link)..i get the values displayed in the same page..!!
Retriving and all at backend i have done in java..!!!
Can u help me now???
[edited code so people can read it!:Eric]
REMEMBER TO TURN SMILES OFF!
[ November 20, 2003: Message edited by: Eric Pascarello ]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
if you want to load in the parent you need to not use self!
window.opener.location.href = BLAH;
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Popup to parent communications
 
Similar Threads
Display data from combobox into Table
Listbox
how to do readonly lists in jsp
Looking for ideas/discussion on "Best Approach"
select values for second drop down