Go4Expert (http://www.go4expert.com/)
-   JavaScript and AJAX (http://www.go4expert.com/forums/javascript/)
-   -   Pop Up Window (http://www.go4expert.com/forums/pop-up-window-t504/)

prashantSum 14Nov2005 12:47

Pop Up Window
I don't know exactly where to post this exactly, please forgive if I should not have posted it here.

I have a problem, I have to open a popup window in which I have to show some check boxes, now when the user selects some check boxes I want get these values back to the window from where the popup window has been opened.

how can I do this.. I am using J2EE on the server side, does request has to sent back to server,.. or can I do it in some other way...

please help me...

shabbir 14Nov2005 14:56

Re: Pop Up Window
This can be done using the plain JavaScript and does not need to be passed to the server. You can just write a JS function to reflect the changes from the child to the parent in the following manner


<script language="javascript">
function reflect()
        parent.opener.window.document.<FormName>.<FieldName>.value = document.<ChildFormName>.<Field>.value;
        return true;

pradeep 14Nov2005 15:37

Re: Pop Up Window
To pass on some values to the "opener" window from the "opened" window, you have to use the window.opener object.


//in the original window
  var bValueFromPopup = false;
  //this opens the file pop.htm in a new pop-up window.
  //in pop.htm, if you want to change/pass a value to the orginal window
  //this will change the value of the variable bValueFronPopup in the main window.

You got the logic, hope now u can work on your problem.In case of any prob, dont worry, I am just a mouse click away ;-)

Computers are like airconditioners, if you open WINDOZE they don't function!


prashantSum 14Nov2005 15:50

Pop Up Window
thx for the replies,

I got that it....

one more thing is, I have some check boxes in the popup window, now when select some check boxes in the that window and close that window and again open it check boxes which I have selected previously are not persisted (they are again coming to non select state)..

how can we persist those selections until the parent form is submmited

pradeep 14Nov2005 15:53

Re: Pop Up Window
Yes, you can do that, all you have to do is read the data from the main page,using the same logic.

prashantSum 14Nov2005 19:17

Re: Pop Up Window
thx for the replies,

parent.opener.window.document.<FormName>.<FieldNam e>.value = document.<ChildFormName>.<Field>.value;

now the above code is working fine when I opened a window with window.open

it's not working when I open a MODAL window....

with window.showModalDialog(....)

does it not work with the modal windows or do I need to change some code

pradeep 15Nov2005 10:46

Re: Pop Up Window
parent.opener wont work with showModalDialog, 'cause its not a pop-up window, its a dialog.You can pass & retrive values in ModalDialog too, for more help on that check this link http://www.webreference.com/js/column90/3.html

prashantSum 15Nov2005 15:31

Re: Pop Up Window
thx pradeep,

I got it.

All times are GMT +5.5. The time now is 09:19.