04-01-2022, 02:57 AM
(This post was last modified: 04-01-2022, 03:46 AM by Alexandre Machado.)
1- The OnAsyncChange event is working as designed/expected. HTML DOM OnChange event doesn't trigger if the property is changed via code (you can test this with a simple HTML such as:
If you open the console in Dev tools (F12) and type:
document.getElementById("myCheckBox").checked = true
you will see that the alert() message won't popup (but it will in any other case where the user directly changes the value via keyboard or mouse).
This is one of multiple security layers of the browser. The browser "knows" and treats differently what is done by direct user intervention (e.g. a mouse click) and what is done via code (setting a property of a DOM element). Our implementation follows the same rules.
2- OnClick of the IWRadioButton: In my tests it works correctly. Have in mind that IWRadioButtons only work if there are more than one with the same Group property. If you have only one RadioButton, it won't work as a CheckBox.
3- CheckBox's OnAsyncChange is indeed triggering twice. This is going to be fixed.
4- OnAsyncEnter/OnAsyncExit are not working as you would expect because they are attached to the label part of the control, not the control itself. To be honest, it's not usual to attach any code to these events for CheckBoxes and RadioButtons, but I'll add it to the TODO list as well
BTW, in all metioned controls, use always OnAsyncChange/OnChange events if you are interested in the state of the control. Never use OnAsyncClick/OnClick events, unless you really want to detect a mouse click over the control, not a state change.
Code:
<!DOCTYPE html>
<html>
<body>
<input id="myCheckBox" type="CHECKBOX" onchange="myChangeEvent()">
<script>
function myChangeEvent() {
alert("onchange triggered");
}
</script>
</body>
</html>If you open the console in Dev tools (F12) and type:
document.getElementById("myCheckBox").checked = true
you will see that the alert() message won't popup (but it will in any other case where the user directly changes the value via keyboard or mouse).
This is one of multiple security layers of the browser. The browser "knows" and treats differently what is done by direct user intervention (e.g. a mouse click) and what is done via code (setting a property of a DOM element). Our implementation follows the same rules.
2- OnClick of the IWRadioButton: In my tests it works correctly. Have in mind that IWRadioButtons only work if there are more than one with the same Group property. If you have only one RadioButton, it won't work as a CheckBox.
3- CheckBox's OnAsyncChange is indeed triggering twice. This is going to be fixed.
4- OnAsyncEnter/OnAsyncExit are not working as you would expect because they are attached to the label part of the control, not the control itself. To be honest, it's not usual to attach any code to these events for CheckBoxes and RadioButtons, but I'll add it to the TODO list as well
BTW, in all metioned controls, use always OnAsyncChange/OnChange events if you are interested in the state of the control. Never use OnAsyncClick/OnClick events, unless you really want to detect a mouse click over the control, not a state change.

