• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to call parent window id in child window

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I need to call parent hidden field in child window. How do I do that in JavaScript?
 
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
looks like there is no other way than sending the data from parent while opening the child window. They cannot be in sync until there is request to your server(in sync or async using ajax) to update/read parent and populate the same in child.
 
sravani gogineni
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
could you please tell me how do i send parent data to child window when i open a child window?
 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is there in it? Am i missing something? Am on the same page as yours..

Anyways, it is same as how you get the data in your parent read, it from the infrastructure of your application. It can be from any scope - the application (retrieve from the static variables in child window), session(retrieve from the session which you would set before opening child window), request (same from request). how to set these values in different scope is the actual story. Say if you are not processing any request in the server side to open the (somewhat called static JSP) child then you can just put it in the URL (like childURL?parameterName=value) but it is not recommended for security reasons and not a good practice.
 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sravani gogineni wrote:Hi

I need to call parent hidden field in child window. How do I do that in JavaScript?



Do you want to send the field or the field value (content)??
If you want to pass the field content, I think that you would must to try passing the parameter by url similar to this
I think you won't have problems if the new windows is a popup (child)

 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks jhon, i was having the prepective that the child is a popup/newwindow being opened from javascript
 
sravani gogineni
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to place a hidden field in main page and child page for storing the session id. i want to compare both and see if they are equal then proceed else go to login page.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sravani gogineni wrote:I need to call parent hidden field in child window. How do I do that in JavaScript?


You don;t "call" fields so what is it you are really trying to do?

Perhaps change the value of the field from the child? If so, you can find a reference to the parent window in the opener variable.
 
sravani gogineni
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:

sravani gogineni wrote:I need to call parent hidden field in child window. How do I do that in JavaScript?


You don;t "call" fields so what is it you are really trying to do?

Perhaps change the value of the field from the child? If so, you can find a reference to the parent window in the opener variable.



I tried using this :
var test =window.opener.document.getElementById('field1').value;
alert(test);

but the alert box is not seen
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does the JavaScript console show? Any errors?

Check each part of your reference chain to make sure that things are evaluating to what you think they are supposed to.
 
sravani gogineni
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JS console ? how do i look at it? As of now i dont see any errors in the left hand corner of the window.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are writing JavaScript you need to become familiar with the tools necessary. For Firefox, download Firebug. Chrome, Safari and IE8/9 come with their own debuggers.
 
sravani gogineni
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I dont see any errors in the console.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Start checking each step in your reference. Does each step evaluate to what you think it does?
 
Hey! You're stepping on my hand! Help me tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic