Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to call parent window id in child window

 
sravani gogineni
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I need to call parent hidden field in child window. How do I do that in JavaScript?
 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • 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
  • 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 Java Oracle
  • Mark post as helpful
  • send pies
  • 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.
 
jhon masco
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • 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 Java Oracle
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64700
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
Author and ninkuma
Marshal
Pie
Posts: 64700
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
Author and ninkuma
Marshal
Pie
Posts: 64700
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
I dont see any errors in the console.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64700
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Start checking each step in your reference. Does each step evaluate to what you think it does?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic