Form event "change" fires when data parsed

Hello,

i want to save a form after some value was change by hand.

How can i distinguish if a form was filled by the “paste” methode or a field is change by hand?
Then event “change” fires in both cases!

form.data.parse(data);

form.events.on(“Change”,function(id, new_value){
//
});

Regards Stephan

Currently there is no possibility to split the changes made by the user with the changes made by API.
I may suggest you only to use the setConfig() method to update your form. It won;t trigger the change event.
In the future update we’ll try to add a more elegant solution.

Now that setConfig() is deprecated, what solutions are available to distinguish between manually changing values and data loading/parsing using setValue()? Or is there a way to “pause” event triggering, so that I can set the event function, but temporarily turn it off when I’m doing my initial data load?

In the meantime, if anyone else is looking for a workaround, I created a variable that indicates if I’m parsing data or not, and only perform the event action if it indicates I am not.

https://snippet.dhtmlx.com/v2k8kvmy

Because I’m using AJAX in my project to load the form data from a database, I moved the line to unset the variable into the Promise object of the AJAX call.

form.dataLoading = true;
dhx.ajax.get(url).then(function(data){
    form.setValue(data);
    form.dataLoading = false;
});