Onchange event not triggered

I have the following problem.

We are creating a form with an ajax call and append this form to our page. In this form the onchange event (combo.attachEvent(“onChange”, setFilters):wink: from the combobox is not triggered.

When I put the combobox in a normal form, not appended, then the onchange event is triggered.

We need more details for the issue.
Are you using dhtmlx form? If you are, which version ?

I am not using dhtmlx form, but a normal form.

I have made a own function that put a filter from one ComboBox (sel1) on the next ComboBox (sel2), named setFilters.
I am using the ComboBox in a search form. This form had several default fields. The form can be extended with more search fields with an ajax call.

container = $("

").attr(‘id’,containerid);
var form = $.get("/advanced", { item: “”+curitem+"", table: “”+curtable+""}, function(data){
container.append(data);
});

The containers is now appended with a form. In this form the following script is included:

$(window).load(function() { // Feature test to see if there is enough W3C DOM support
if (!document.getElementById) return;

var sel1 = document.getElementById(‘qb_01_invoice__administration_id__13’);
if(!sel1) {var sel1 = getCombo(“01_invoice[administration_id]”); }

var sel2 = document.getElementById(‘qb_01_invoice__creditor_id__15’);
if(!sel2) { var sel2 = getCombo(“01_invoice[creditor_id]”); }

sel2.ajaxFilter = sel1;
sel1.attachEvent(“onChange”, setFilter);

function setFilter() { refreshOptions(sel2.id,sel1.id); }
});

I have tried to use the $(window).ready but that doesn’t trigger the onchange function either.

In the normal, default search form that is not appended using ajax, the onchange event is triggered. In the form that is appended the onchange is not triggerd

sel1.attachEvent(“onChange”, setFilter); here sel1 should be a dhtmlxCombo object that is created by dhtmlXCombo or dhtmlXComboFromSelect.

The example in combo package:
dhtmlxCombo/samples/05_events/01_combo_events.html

sel1 is an object of combobox.

I have made this function to get the combobox by his id

function getCombo(id)
{
if (!window.dhx_glbSelectAr) return false;
for (var j=0;j<window.dhx_glbSelectAr.length;j++) {
if (window.dhx_glbSelectAr[j].id == id || window.dhx_glbSelectAr[j].name == id) return window.dhx_glbSelectAr[j];
}
}

The problem only appears when I do an onchange if the form is appended to the DOM through an ajax call and an append

we need the completeddemo to recreate the problem locally.