Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Vikram on Dec 10, 2008 01:58
open dhtmlx forum
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 :: http://localhost:8080/Visibility/dhtmlxWindows/codebase/dhtmlxwindows.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.
Answer posted by Support on Dec 10, 2008 02:39
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);
}