Hi,
Here you have a short video of my case. Hope this helps to understand my goal:
Above, I have a group of 29 groupboxes which onChange (if checked) they send a text value to a text box nearby. If not checked, they send an empty string. My concern is that I don't want visitors to be able to check more than one checkbox at a time, meaning, I want the 'checking' of one to 'uncheck' the other. I merely did this by:
$w("#checkbox1").onChange( (event) => {
if ($w("#checkbox1").checked) {
$w("#checkbox2").checked = false;
$w("#textDescription").text = "......";
.....
With the code above, when I check #checkbox1, it unchecks #checkbox2.
What I need though is something more automatic and clever: On Change, If checkbox[1-29] is checked THEN ALL other possibly already checked checkboxes should be changed to .checked=false. Also, when the visitor clicks on CLOSE to close this specific panel, all previous checked boxes must reset to 'false'.
I understand that a "for-loop" could be used here with a looping variable to get values from 1 to 29 and by concatenation to assign it to the #checkbox[i] element and then this element to be checked [i] times for .false or .true state and change its value on the road to FALSE, but this is as far as I can get at the moment...
Would you help please?
Thanks!
List them all
untick all
tick the event.target.id
$w("#checkbox1, #checkbox2, #checkbox3, #checkbox4, #...").onChange( (event) => { $w("#checkbox2, #checkbox3, #checkbox4, #...").checked = false; $w(`#${event.target.id}`).checked = true; $w("#textDescription").text = "......"; .....
Idea ONLY, please try in editor