window close

Dear Support Team!

I have a problem with close method.

Here is the code init.js :

function init(){
	dba.layout = new dhtmlXLayoutObject(document.body, "1C");
	dba.tabbar = dba.layout.cells("a").attachTabbar();
	dba.tabbar.setImagePath("/infobase_web/dhtmlx/tabbar/imgs/");
	dba.tabbar.enableTabCloseButton(true)
	dba.tabbar.loadXML("/infobase_web/tabbar.xml");
	dba.tabbar.attachEvent("onTabClose",function(id){
			delete dba.pages[id];
			return true;}
			);
	dba.menu = dba.layout.cells("a").attachMenu();
	//dba.menu.attachEvent("onClick", menuClick);
    dba.menu.loadXML("/infobase_web/dhxmenu.xml?etc="+new Date().getTime());
	var win=dba.layout.dhxWins.createWindow("w1",1,1,300,180);
		win.setText("Login");
		win.setModal(true);
		win.denyResize();
		win.center();
		win.attachURL("/infobase_web/index.php/login");
        win.attachEvent("onClose", function() {
        window.close();
    });

and login.php (mvc) snipet

.....
if($data['username'] == $username && $data['passwd'] == do_hash($passwd, 'md5'))
		{
			echo '<script>parent.win.window("w1").close();</script>';
		}
.....

but a received javascript error and window don’t close

thanks for your help

Hello,

parent.win.window(“w1”).close();

win must be a public variable (it is private in your code)

win=dba.layout.dhxWins.createWindow(“w1”,1,1,300,180):wink:

instead of

var win=dba.layout.dhxWins.createWindow(“w1”,1,1,300,180);

THX working