Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Javascript (http://www.velocityreviews.com/forums/f68-javascript.html)
-   -   window.opener lost in postback (http://www.velocityreviews.com/forums/t930477-window-opener-lost-in-postback.html)

Frank 03-30-2007 01:30 PM

window.opener lost in postback
 
Hello everyone,

I have a problem that the window.opener variable is lost once my popup
page has a postback. On multiple pages they address this problem but I
cannot find a correct answer.

This is my situation:

I have a main page which shows invoices. When a user clicks on the
invoices they get a popup where they can alter the invoice which uses
postbacks because of direct changes in the database. Finally the user
can click a button to accept the invoice and then I need to change two
variables on the main page which opened this popup, the new invoice
fee and status (which is based on the button pressed). I dont want any
postbacks on the main page, therefore I simply want to pass these two
variables from the popup to the main page.

However, after a single postback on the popup page the window.opener
variable is gone and lost forever. Now I have seen solutions using
frames but I do not know how to go from there because I also pass some
variables from the main page to the popup.

Hope someone can help me,
Regards Frank


Marc 03-30-2007 06:35 PM

Re: window.opener lost in postback
 
"Frank" <f.f.neezen@gmail.com> wrote in message
news:1175261442.129280.119350@n59g2000hsh.googlegr oups.com...
> Hello everyone,
>
> I have a problem that the window.opener variable is lost once my popup
> page has a postback. On multiple pages they address this problem but I
> cannot find a correct answer.
>
> This is my situation:
>
> I have a main page which shows invoices. When a user clicks on the
> invoices they get a popup where they can alter the invoice which uses
> postbacks because of direct changes in the database. Finally the user
> can click a button to accept the invoice and then I need to change two
> variables on the main page which opened this popup, the new invoice
> fee and status (which is based on the button pressed). I dont want any
> postbacks on the main page, therefore I simply want to pass these two
> variables from the popup to the main page.
>
> However, after a single postback on the popup page the window.opener
> variable is gone and lost forever. Now I have seen solutions using
> frames but I do not know how to go from there because I also pass some
> variables from the main page to the popup.
>
> Hope someone can help me,
> Regards Frank


If you are able to capture the variables in the popup then you could get
those in a framepage as well... right?
in the window.onload of one of the frame pages you can use window.parent to
get javascript variables from... the parent...
even after a reload/submit you'll be able to get those but only if the
target of the form submit is 'self' of course...

search for window.parent
(or perhaps window.top to get easy access to the top frame instead of
parent.parent.parent which I have seen people doing...)



Richard Maher 03-31-2007 12:17 AM

Re: window.opener lost in postback
 
Hi Frank,

> However, after a single postback on the popup page the window.opener
> variable is gone and lost forever. Now I have seen solutions using
> frames but I do not know how to go from there because I also pass some
> variables from the main page to the popup.


FWIW this is how I "pass" (tell the details frame to "receive" parameters)
If there is a better way please let me know. It's not very modular but hey
:-)

Main Page (With scrolling select list of Invoices)
================================

detailLoc = parent.frames["entry_details"].location; // Global, set
onload
: : :

function showDetails()
{
if (selectRef.selectedIndex == 0) //First line is a Header line
return false;

detailLoc.reload(); // Trigger the onload event in the details
form - a bit kludgy?
parent.document.getElementById("main").rows="30px, 0px,*"; // Show the
details form
return true;
}

Details Page
========

function load()
{
chan =
parent.frames["cornucopiae"].document.getElementById("CornuCopiae");

try
{
selectRef =
parent.frames["queue_lookup"].document.getJobs.jobList;
getDetails();
}
catch(err)
{initData()};

}

function getDetails()
{
headColor =
parent.frames["cornucopiae"].document.getElementById("torso").style.backgrou
ndColor;

parent.frames["cornucopiae"].document.getElementById("torso").style.backgrou
ndColor = "Silver";
document.display.entryNumber.value =
selectRef.options[selectRef.selectedIndex].text.substring(0,
10);
return true;
}

function goBack()
{
selectRef.options[selectRef.selectedIndex].selected=false;

parent.frames["cornucopiae"].document.getElementById("torso").style.backgrou
ndColor = headColor;
parent.document.getElementById("main").rows="30px, *,0px";
return;
}

You (I) have to use the try/catch because when the "real" load of the
details page occurs, context and some variables are unavailable but when I
reload() they are.

Cheers Richard Maher

"Frank" <f.f.neezen@gmail.com> wrote in message
news:1175261442.129280.119350@n59g2000hsh.googlegr oups.com...
> Hello everyone,
>
> I have a problem that the window.opener variable is lost once my popup
> page has a postback. On multiple pages they address this problem but I
> cannot find a correct answer.
>
> This is my situation:
>
> I have a main page which shows invoices. When a user clicks on the
> invoices they get a popup where they can alter the invoice which uses
> postbacks because of direct changes in the database. Finally the user
> can click a button to accept the invoice and then I need to change two
> variables on the main page which opened this popup, the new invoice
> fee and status (which is based on the button pressed). I dont want any
> postbacks on the main page, therefore I simply want to pass these two
> variables from the popup to the main page.
>
> However, after a single postback on the popup page the window.opener
> variable is gone and lost forever. Now I have seen solutions using
> frames but I do not know how to go from there because I also pass some
> variables from the main page to the popup.
>
> Hope someone can help me,
> Regards Frank
>




Frank 04-06-2007 09:37 AM

Re: window.opener lost in postback
 
Thanks Marc and Richard,
I will try to use the frames idea to save the variables. I tried it
once but it didnt work out, guess I'll have to try again!

Regards,
Frank


Frank 04-08-2007 12:14 PM

Re: window.opener lost in postback
 
Help !

Well I tried to use frames. I currently have the mainwindow,
factuurOverzicht which opens a new window onclick, which is a frameset
called: factuurFrameset. In this frameset I pass the variables in the
querystring to the frame inside this frameset and load factuur.aspx
with the variables needed. This goes fine. Also, in the mainwindow
factuurOverzicht I set the opener of the factuurFrameset to
factuurOverzicht. Furthermore, from the frame factuur.aspx I can call
window.top.opener and retreive the opener for factuurOverzicht.

However, after I submit data to factuur.aspx (which is handled in
codebehind), such as for editing e.a., the frames and all still work
but I loose the window.top.opener. What could be wrong?

Regards,
Frank

On 6 apr, 11:37, "Frank" <f.f.nee...@gmail.com> wrote:
> Thanks Marc and Richard,
> I will try to use the frames idea to save the variables. I tried it
> once but it didnt work out, guess I'll have to try again!
>
> Regards,
> Frank





All times are GMT. The time now is 08:05 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.