Pass data between windows..
Hi !!
When user click on a button I show a new pop-up window to give him a treeview. He makes his choice and I must show that in the main window...
How can I do that, please?
..
[This message has been edited by Akim (edited 24 May 2000).]
Vincent Puglia posted this at 23:54 — 24th May 2000.
They have: 634 posts
Joined: Dec 1999
HI,
Try something like:
1) name your popUp
myTreeWin = window.open(blah, blah....
2) pass the selection back to the main window
popChoice = myTreeWin.popChoice; (this assumes you have declared the var in both windows.)
3) Once you have the var, close the popUp, then redirect the window.
myTreeWin.close();
location.href = popChoice;
Vinny
------------------
GrassBlade: cut&paste javascript
The Javascript Place Forums
Where the world once stood
the blades of grass cut me still
Vincent Puglia posted this at 04:54 — 25th May 2000.
They have: 634 posts
Joined: Dec 1999
Hi Akim,
Guess I'm confused, but...
1) you reference the main window with:
opener.varname;
opener.document.formname.elementname.value;
2) The two statements I made are not necessarily one after the other (I don't know your code, so I can't tell you where to put them.) They are examples.
3) re: "There is not waiting time between the 2 instructions"
You do not need waiting time. Windows do not automatically close. I'm presuming your TreeView is some sort of form that collects a value (popChoice). Once you have that value you can pass it back to the main window (if that is what you want to do) and focus the main window ("opener.focus()"), and then close the popUp (if that is what you wnat to do.)
Vinny
------------------
GrassBlade: cut&paste javascript
The Javascript Place Forums
Where the world once stood
the blades of grass cut me still
Akim posted this at 13:51 — 25th May 2000.
They have: 6 posts
Joined: May 2000
thanks Vincent,
- But the thing is that the popup window which should reference the main one and not the inverse : There is not waiting time between the 2 instructions
myTreeWin = window.open(blah, blah....
popChoice = myTreeWin.popChoice;
- Is there a way to reference a window by for example Windows collection (if exists)?
- Or It's not a good practice to design my web app like that... And I should find another method??
Thank you for your help.
Akim posted this at 17:50 — 25th May 2000.
They have: 6 posts
Joined: May 2000
Thank you very much !!!
With the OPENER object you've saved me!!
now I can access to the main window object easily.
Thank you Vincent.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.