I have a simple page with a question for the user, followed by 4 potential answers.
Only one answer is correct.
I want the user to be able to tap on an answer, but if they change their mind and tap another, I want the first one to uncheck. They can only pick one.
Checkboxes allow multiple answers
Radio buttons allow only one choice, however appgyver doesn’t seem to support radio buttons & I can’t find any components to install for these.
I have tried using IF statements - that is when a user clicks on answer 1, check IF the other 3 answers have been picked before and if they have then set them to unchecked - however Appgyver IF statements don’t seem to allow for this sort of functionality and I can find no way in the components to reset a check box.
What am I missing? This should be pretty simple no?
Thanks
I used an Object page variable. I created one item for each Checkbox in the object. In your case, each potential answer would be represented visually with a check box and in the page variable as an item in the object page variable.
I associated each page variable object item (i.e. each answer) with one of the check boxes so they would be bound.
From there, I use the Set Page Variable flow logic item on each component tab event for each Answer checkbox in the logic section to set the Answer as True and the other 3 page variable items to False. You will now have a radio button effect using checkboxes.
I didn’t check out many scenarios with my approach, but it seems to work at a basic level.
All that being said, I would agree that having a radio button visual control would be a great addition.
I agree, a radio button component should be part of the standard set – once we get the new runtime out, composite components become a lot more powerful as we can use the composite component root properties directly in formulas within the composite internals.
Currently, is there a way to choose one between many options? Block out choosing of other options, unless they want to change their selection. And send that chosen one as the input to backend?
@LB_In_Kona Steve described how to do it. You need a page variable per checkbox that you bind to the value of the checkbox. Then you go to the flow logic and set something like this: Component tap → set page variable for this checkbox to true and set page variable for other check boxes to false.
The same flow you repeat for the other checkboxes.