CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Best Way to Return to Parent/Calling Window [RESOLVED]

Print topic Send  topic

Author Message
ab5ni


Posts: 177
Posted: 08/21/2010, 2:35 PM

Hi folks,

I'm looking for a way for a pop-up to return to a parent window. That is, I don't want to hard-code the return page. I always want the pop-up to return to the page it was called from. Any suggestions?

TIA
_________________
Randall Jouett
Amateur Radio: AB5NI
I eat spaghetti code out of a bit-bucket while sitting at a hash table! And yes, I paid for the meal in cache!


View profile  Send private message
roeya


Posts: 181
Posted: 08/22/2010, 7:19 AM

If the window is a popup (not an ajax dialog) then using javascript it is easy to get access from the popup to the parent:
window.opener.document;

if you need to update the parent and close the popup you can use something like:
  
window.opener.document.location.reload();   
window.close();  

If you just want to know the page that called the current displayed page use HTTP_REFERER

if Perl use $ENV{HTTP_REFERER}
on PHP use $_SERVER['HTTP_REFERER']

_________________
http://www.infoneto.com/
View profile  Send private message
ab5ni


Posts: 177
Posted: 08/23/2010, 12:05 PM

Using PHP. Basically, the parent is calling a pop-up that's generating a table entry, and I'm trying to pass the parent the primary key via an "After Execute Insert" CCS Event, and the parent is also making a table entry and inserting the pop-up provided primary key as a foreign key.

Currently, I'm using "SELECT last_inserted_id() as lid" MySQL statement to get the key, and then I'm using CCSetSession($last_insert_id, $lid), then picking up the key on the parent, but this "solution" seems kinda nasty and them some :-D. As far as I know, the primary key is not available on the form, so it can't be passed via javascript to the parent. What further complicates things is there is a distinct possibility that multiple users will be entering data simultaneously, so CCGetSession() could pick up the wrong key from the pop-up (or am I missing something here?).

Anywho, this is what I'm dealing with, along with the previous "return to parent" issue :-D.
_________________
Randall Jouett
Amateur Radio: AB5NI
I eat spaghetti code out of a bit-bucket while sitting at a hash table! And yes, I paid for the meal in cache!


View profile  Send private message
roeya


Posts: 181
Posted: 08/25/2010, 8:02 AM

Quote ab5ni:
What further complicates things is there is a distinct possibility that multiple users will be entering data simultaneously, so CCGetSession() could pick up the wrong key from the pop-up (or am I missing something here?).

why not create a session key based on user_id ?

for example = CCSeetSession('pm_key_' . CCGetUserID(), $pm_pkey)

and in the main window use - CCGetSession('pm_key_' . CCGetUserID());

_________________
http://www.infoneto.com/
View profile  Send private message
ab5ni


Posts: 177
Posted: 08/26/2010, 4:17 PM

Hmmm. will give that a shot. ty.

_________________
Randall Jouett
Amateur Radio: AB5NI
I eat spaghetti code out of a bit-bucket while sitting at a hash table! And yes, I paid for the meal in cache!


View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.