Benjamin Krajmalnik
|
Posted: 03/13/2007, 5:39 PM |
|
In my applications, I often have popup windows which are called to enter
data, emulating a MDI applicatio.
The modificatio required to open these windows as a popup (as opposed to use
the "_blank" target) is very simple.
For example, I have an image link called "EditPhones".
<a href="{EditPhones}" onclick="OpenPopup(this.href);return false;"><img
src="images/edit.gif" border="0"></a>
I haveadded the following to functions.js
function OpenPopup(strRef)
{
/***
PURPOSE: Open Popup Window
IN: strRef - href of the window to open
***/
var win=window.open(strRef,"InfoPopup",
"left=50,top=50,width=800,height=600,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes");
win.focus();
}
Now, on the called form, I insert a label called "Autoclose" in the client
side "OnLoad" for the form, as follows:
if ({Autoclose}) {
window.opener.location.reload();window.close();
}
In the AutoClose BeforeShow event I added the following:
if (CCGetParam("Autoclose", "") == "") {
$Component->SetValue("false") ;
} else {
$Component->SetValue("true") ;
}
Now, on the OnClick Server side events of the different buttons I add:
global $FileName;
global $Redirect;
$Redirect = $FileName . "?Autoclose=1";
The onClick() client side event of the canbcel button has the following:
window.opener.location.reload();window.close();
This method should be portable to any language. In ASP I was streaming
Javascript via response.write in the afterupdate/afterinsert/afterdelete
events, but for some reason in PHP this did not work.
|
|
|
|