I’m creating a quiz app; question plus 4 possible answers. Each answer has a checkbox and only one box can be checked (like an option button). I’m trying to identify which of the 4 checkboxes has its value set to true.
I would be grateful for any help.
Welcome to Thunkable.
You will need to have the four check boxes as a group or a list then you create a function to loop through the list testing which one is selected.
You will also need to create another function that will update the status of the four check boxes whenever the user clicks any of them. Your function will turn the status off on all of them except the one clicked.
This can be done easier in StP but it can also be done in DnD.
I have the checkboxes in a group and loop through them with a “for each item” block. The loop is inside a “when Any Checkbox Value Changes” block. Inside the loop I’m setting all the checkbox values to false, referencing them using the “j” object. I then set the checkbox that initiated the call to true - referencing it using the “component” object. My problem is identifying which checkbox is true.
I’m teaching a class mobile app development at a fairly low level. We made the decision to use DnD, so I have to stick to that.
Muneer, that’s above and beyond the call of duty and I really appreciate it.
The core of the solution is having standard naming convention for the checkboxes.
This is how the screen will look like
The coding part is divided in two parts
Part 1 is to take care of the tick whenever the user clicks on one of the checkboxes by removing the tick on the other and making the tick appear on the select one
Part 2 is to loop through the checkboxes and report which one is ticked.
this is just my opinion. i think you should stick to using radio buttons for single choices and check boxes for multiple choices. it has already been a standard accepted by default. you will only confuse your user if you present check boxes but they don’t behave the way they should…
As far as I know Thunkable does not provide the
radio option. Of course you can use a button and shape it round to look like a radio button but it will not automatically function as a radio button. You still need a similar code to function in the way users will expect it to be,
I used to make checkboxes this same way!! Nice example
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.