Bug: Form Combo Boxes Cannot Change Parameters During Event


#1

Here is a snippet that reproduces this issue: https://snippet.dhtmlx.com/npum3g0z

I want to mark the form items that have been modified using CSS.
To do this, I am putting a “is-dirty” class on the items during an on-change event like this:

form.events.on("change", function (name, value) {
    form.getItem(name).setProperties({ css: "is-dirty" });
});

If this is done to a combo box, then it causes lots of internal errors:
image

I think this happens because it wants to show the dropdown list after making a change to the input box.
Here’s a bad way for the user to fix this:

form.events.on("change", function (name, value) {
    const item = form.getItem(name);
    setTimeout(() => {
        item.blur();
        setTimeout(() => {
            item.setProperties({ css: "is-dirty" });
        }, 50);
    }, 50);
});

A better solution would be for the library to (in the functions that could be triggered by a destructor) check the config variable (because the destructor removes it) before using it like this:



#2

I apologize for the delay. Thank you for your report. The problem is confirmed. We’ll try to fix it in future updates.
I’ll inform you about the progress on this issue.