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 data from Child window to parent window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "data from Child window to parent window" Watch "data from Child window to parent window" New topic
Author

data from Child window to parent window

Rex Rock
Ranch Hand

Joined: Jun 25, 2001
Posts: 82
I have a button in my parent window, which when clicked opens a child window. The child window lets user do some selections, when the user closes the child window, I want to transfer the selections made in the child window to appear in the parent window. Not sure how to go about getting this done.
I'm on a tight deadline, thats why posting silly and easy(?) questions like this, else would have experimented myself.
Rex
James Swan
Ranch Hand

Joined: Jun 26, 2001
Posts: 403
In your child window do something like:
window.opener.document.myForm.myTextField.value = myValue;
where:
myForm is a form on the parent window
myTextfield is a text field in the form on the parent window.
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Rex
Something like this in your child window would be in the onsubmit event handler after you verify the data:

the 'formName' is the name of the form on the parent window.
myField is the name of the textbox on the parent form.
newValue would be whatever the new value is.
The fields on the parent form could be hidden or visible as need be. Once you have the handle to the parent form you can manipulate the form elements as if you were on that page itself - checking checkboxes, selecting items in a list etc..
hope that helps


Dave
Rex Rock
Ranch Hand

Joined: Jun 25, 2001
Posts: 82
Thank you guys. That was a timely help
Joe Higgs
Greenhorn

Joined: Nov 14, 2003
Posts: 2
I too need to know something about this topic. I've been looking through so many resources and learned just a touch, unfortunatly I'm still just a beginner and don't know quite enough.
ok, here's my question: Why isn't the child window passing data to the parent window as I was hoping it would?
here's the complete code for the child:
**************************************************

**************************************************
and the parent:
**************************************************

**************************************************
any help would be so much appreciated.
Thanks in advance.
[ November 14, 2003: Message edited by: Joe Higgs ]
[ November 14, 2003: Message edited by: Joe Higgs ]
[ November 14, 2003: Message edited by: Joe Higgs ]
[ November 14, 2003: Message edited by: Joe Higgs ]
[edited to make readable: Eric]
[ November 14, 2003: Message edited by: Eric Pascarello ]

J. Higgs<br />yeah, i know... i'm a newbie
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Welcome
Next time please just post a new topic....
plus use ubb code tags

tags around your code
What is your problem exactly before I go and look through your code.
Eric
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
I think i might have figured it out
you are not referenceing the name of the form for the parent window
basically
window.opener.document.FORMNAME.ElementName.Value
Eric
Joe Higgs
Greenhorn

Joined: Nov 14, 2003
Posts: 2
Thank you so much for your help. Like I'd said before, I'm quite new at this. Your help and patients is much appreciated.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: data from Child window to parent window