modbselect onchange not working
Issue #361
resolved
onchange event is not triggered for modbselect.
Comments (3)
-
reporter -
- changed status to resolved
The code is correct. The validation function gets called with the current value and the DOM element, thus we have
let flag = eval(this.dataset.validate)(this.value, this);
The validation can return "true" or "false". If returned false, the value does not get propagated to the ODB. So the mjsonrpc_db_set_value call comes after the
if (!flag)
statement. -
Ok, I realized that any user onchange=”…” gets overwritten by the framework which is not good. So I replaced the framework code with .addEventListener(“change”, …) and now we can have both a user “onchange” function and the framework correctly sending data to the ODB. The change is comitted.
- Log in to comment
Looking at the code (and if I understand it correctly) it seems that onchange is replaced with data-validate (line 1218). So I have to use data-validate=”function..” instead of onchange=”function..”. But there is still a bug on line 1222, it should be
Also, to get the change propagating to the odb the following lines should come after the eval command