• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

data from Child window to parent window

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Rex Rock
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you guys. That was a timely help
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
permaculture is largely about replacing oil with people. And one tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic