JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 10th, 2013, 11:50 PM
BobbyRachel BobbyRachel is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 1 BobbyRachel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 m 45 sec
Reputation Power: 0
Other - Accessing parent window from child window?

I have a main window named worklistManager.jsp.
worklistManager.jsp has a pop up window named processManager.jsp.
Again, processManager.jsp has another pop up window, named eventLog.jsp.
Once again eventLog.jsp has a pop up window named eventUsers.jsp.

eventUsers.jsp has a dojox/grid/DataGrid and a button. After selecting a particular row in the grid, then clicking the button, it has to place the value into the textbox of eventLog.jsp after closing eventUsers.jsp.

So far, I have tried the script below to accomplish this, but it's not working as I hoped.

Code:
<script type="text/javascript">
        function getEventLogUserSelect(){
         if(dijit.byId('dynamiceventusergridCWUSER')){
         var selctedItem = dijit.byId('dynamiceventusergridCWUSER').selection.getSelected();
                 if(selctedItem.length){
                  dojo.forEach(selctedItem, function(selectedItem){
                  if(selectedItem !== null){
                  dojo.forEach(dijit.byId('dynamiceventusergridCWUSER').store.getAttributes(selectedItem), function(attribute){
                  var value = dijit.byId('dynamiceventusergridCWUSER').store.getValues(selectedItem, attribute);
                  if(attribute == "USERID"){
                  window.opener.SetValue(value);
                  window.close();
                  }
                  
                  });
                  }
                  });
                  //alert("grid row selected");
                 }else{
                  alert("grid row not selected");
                 }
         }
                if(gbshowgridFlag==false){
                 alert("grid not loaded");
                }
        }
        function SetValue(val){
                var txt = document.getElementById('CWPROCESSEVENTLOG.USER_ID');
                txt.value = val;
                
         }
        </script>

Reply With Quote
  #2  
Old February 11th, 2013, 12:43 PM
web_loone08's Avatar
web_loone08 web_loone08 is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2008
Posts: 599 web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 12 h 40 m
Reputation Power: 69
Look into HTML5 Web Storage; specifically sessionStorage. This will allow you to send variables, though session data, across multiply windows.

Reply With Quote
  #3  
Old February 12th, 2013, 01:28 PM
null.if.ied null.if.ied is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 26 null.if.ied User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 15 m
Reputation Power: 0
Quote:
Originally Posted by BobbyRachel
...So far, I have tried the script below to accomplish this, but it's not working as I hoped...


Another solution you might try would be to have another look at your SetValue() function. When you run this script, what are you getting in the console?

javascript Code:
Original - javascript Code
  1. window.opener.SetValue(value);


Seems odd. What if you called the function directly, without the window.opener in getEventLogUserSelect()?

javascript Code:
Original - javascript Code
  1. if(attribute == "USERID"){
  2.     SetValue(value);
  3. }


Then, do all of your window.opener operations in the SetValue() function:

javascript Code:
Original - javascript Code
  1. function SetValue(val){
  2.     var txt = window.opener.document.getElementById('CWPROCESSEVENTLOG.USER_ID');
  3.     txt.value = val;
  4.     window.close();
  5. }


Of course I could be way off base here. Let us know how it goes.

- Null

Last edited by null.if.ied : February 12th, 2013 at 01:30 PM. Reason: Removed empty lines from code.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > Other - Accessing parent window from child window?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap