dhtmlxWindows error on appendObject(form element)

Hi,



I am having a vague error when trying to display a form tag in a dthmlxWindow for the second time.





uncaught exception: [Exception… “Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMHTMLDivElement.appendChild]” nsresult: “0x80004003 (NS_ERROR_INVALID_POINTER)” location: “JS frame :: localhost:8080/Visibility/dhtmlx … windows.js :: anonymous :: line 86” data: no]





I am able to load the window upon clicking a link having a form tag and dhtmlxgrid attached.I close the grid on doRowSelect function within the grid.



When I try to reopen the window again… I am getting the error.Attached is my code spinnet.





function changeUser()

{

     windows= new dhtmlXWindows();

     win = windows.createWindow(“searchwindow”,50,50,700,400);

win.setText(“Search Window”);

     windows.window(“searchwindow”).center();

     windows.window(“searchwindow”).setModal(true);

     win.appendObject(“form”);

    

}





where windows and win are global variables.

Hello,

It seems your object was destructed.
Solution: do not close window, just hide it.
When window closing it destroy inner attached content, and when you try to attach it second time object does not exixts.

Try this code:

function changeUser()

{
    if (!windows) windows= new dhtmlXWindows();
    if (!win) {
        // create window first time
        win = windows.createWindow(“searchwindow”,50,50,700,400);

        win.setText(“Search Window”);

        win.attachObject(“form”);

        win.attachEvent(“onClose”, function(win){win.setModal(false);win.hide();});
    } else {
       // just show window for the second time
       win.show();
    }
    win.center();

    win.setModal(true);

}