object has no method attachevent

Hi,
i have a problem with attachevent method of an object inside a popup.
i have this code:

dhx.ready(function(){
        dhx.ui.fullScreen();
        dhx.ui({
        id:"detailViewComment",
        view:"form",
        css: "overall",
        elements:[
            toolbar,
            {type:"clean",
             cols:[
                  {width:30},
                  entries,
                  {width:30}
                ]
            }
                 ]

   });
   dhx.ui({
            view:"popup",
            id:"menu_status",
            height:120,
            body:{view:"form",
                 id:"form_status",
                 name:"form_status",
                elements:[
               {
               view:"combo",
               id:"txtbox_Status",
               name:"txtbox_Status",
               height:50,
               click:"status_list",
               label: 'Status',
               data:[......],
               select:true,
               y_count:"3"
            },
            { view:"button", type:"form", name: "save_stat",
id:'save_stat', label: 'Save', align:"left", click:"save_status;" }
            ]}
         }).hide();

            dhx.ui({
            view:"popup",
            id:"menu_assigned",
            height:150,
            width:400,
            body:{view:"form",
                id:"form_assigned",
                name:"form_assigned",
                elements:[
                {view:"radio",
                name:"to",
                id:"to",
                align:"center",
                labelWidth:40,
                labelAlign: "left",
                value:"2",
                options:[
                     { label:"User", value: "1", id:"opt1"},
                     { label:"Group", value: "2", id:"opt2" }
                 ]},
               {view:"combo",
               name: "txtbox_Assign",
               yCount:"5",
               id:'txtbox_Assign',
               label:'Assign To',
               data:[..... ],select:true
            },
            { view:"button",
            type:"form",
            name: "save_assign",
             id:'save_assign',
             label: 'Save',
             align:"left",
             click:"save_assign;"
             }
            ]}
         }).hide();
         
$$("txtbox_Status_list").attachEvent("onitemclick",function(){   [u]------here is the problem[/u]
var id =$$("txtbox_Status").getValue();
var name = $$("txtbox_Status_list").item(id).value;
$$("lbl_status").setValue(name);
$$("menu_status").show();
});
 
});

        function close_modal(){
               this.getParent().getParent().getParent().close();
	}

});

so i put the attachevent outside dhx.ui and inside dhx.ready.
the method is called to an object inside the popup (perhaps here is the problem)
i dont understand what am i doing wrong.

In your case, the list element will be created only after related input rendering, which will render self only when popup is visible. So you have two workarounds

a) use more complex init code as

$$("menu_status").attachEvent("onShow", function(){ $$("txtbox_Status_list").attachEvent("onitemclick", function() { ... }); });

or

b) I think you can use onChange event of “txtbox_Status” instead of list’s onItemClick

thank you for your reply,
after i tried the suggestions you gave me, i got the same error.
i don’t even get the alert.

$$("menu_status").attachEvent("onShow", function(){ alert('show popup'); // $$("txtbox_Status_list").attachEvent("onitemclick", function() { // var id =$$("txtbox_Status").getValue(); // var name = $$("txtbox_Status_list").item(id).value; // $$("lbl_status").setValue(name); // $$("menu_status").show(); // }); });

The second option you told me doesn’t work because the error appear on attachevent not inside the event (onitemclick or onChange)
Thanks in advance.

onShow event is fired when hidden popup is displayed. If the problem is still actual, please attach complete demo.

The second option you told me doesn’t work because the error appear on attachevent not inside the event (onitemclick or onChange)

Error occurs because you can’t access txtbox_Status_list control, but you can access txtbox_Status

$$('txtbox_Status').attachEvent("onChange", ... );