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!
|
 |
 |
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/ |
 |
 |
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 . 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 .
_________________
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!
|
 |
 |
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/ |
 |
 |
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!
|
 |
 |
|