Create quiz where you have to select one answer from many?

I have checked the quiz clone app and some other threads, but couldn’t get an idea how a quiz which is not just TRUE/FALSE can be implemented.

For example,

Question 1
– Answer 1
– Answer 2
– Answer 3

You have to select only 1 answer from a radio button. If user later changes the answer, the previous answer must be deleted/updated from the collection and only the second selection should be saved. So at any time, only one selection should be there for one question, or one user.

I have been trying for a couple of days but couldn’t achieve it. The collection operations are limited. you can’t update/delete a record if it’s not the current record, but how can the select answers be current record when you have just created a new record at all and are not even moving to other screen!!

Can anyone please share some idea, hint, or tutorial etc.?

Hi @scientist ,

This is similar to what I just replied.

In your case, it is triggered when you click the list of answer, or just buttons that have actions if you are not using list.

Make custom list visible for countdown inside it to do unchecking and then you can check the selected answer.

Adalo is quite strong in logic, but the way that it presents it to us making it tough to see the whole logic at once.

UI of logic in no code should be treated differently than UI for visual elements, but that could be a factor that Adalo want to avoid as it can be marked as low code.

1 Like

Hi @scientist,

This is achievable, the logic depends on how you structure your database.

The simplest setup which comes to my mind is the following.

Let’s assume you have fixed number of answer options (3) for each question.
Then, you’ll have the collections:

  • Questions, with Question Text, Option 1, Option 2, Option 3;
  • Answers: relation to Questions (M:1), relation to Users (M:1), and 3 boolean properties: option1, option2, option3.
    So each record in Answer can belong only to 1 User and 1 Question.

Let’s move to the screens.

You need to create a “Questions Lists” screen, with a list of all questions. Add two “Answers” button to the list, to go to the next screen.

Then, you have a “Question Details”, where you display a question. You will have “Current Question” available in this screen. On the Questions screen, you display Current Question → Text.

Let’s add some logic.

The first “Answer” button will be conditionally visible: only there is NO answers for this question by this user yet. So it’ll be visible ​ONLY if Current Question → Answers → Count, filtered by Answer → User → Email equals to Logged-in User → Email, equals to 0.

In other words, you’re counting the quantity of records in Answers, where the record should belong to current Question AND to Logged-in User, and if there are 0 such records - you display the button.

The second “Answer” button in fact will be a single-item list. You convert it to a List of Answers, and then add a filter: Answer->Question should be equal to current Question, and Answer → User should be equal to Logged-in User. You may need to use filters by some fields for this.

In other words, this button will appear only if there IS at least one answer for this question by this user. The thing is that in normal circumstances there should not be more than 1 answer per question, as user will not have a possibility to add a 2nd answer.

Hope you’re still with me :slight_smile:

Both of these buttons should lead to “Question Details” screen. But to finish the logic, you need to have “Current Answer” available there.

So, for the 1st Answer button (when there are no answers yet), you add an action “Create Answer”, and set a relation to Current Question & Logged-in User. This means that before going to question details screen, you’ll create a new answer.

And then, on “question details” screen, you put 3 toggles, and set up them in a way that they modify option1, 2, 3 for Current Answer, and add an additional actions to “uncheck” the other options.

Two important notes:

  1. I didn’t test this in a builder and created all this instruction “by memory”. So the probability of some typos is not low :slight_smile: But in general logic should be correct.
  2. This solution is just one of several possible, it’s not the best/easiest/most reliable/robust/etc. There could be other ones - some of them more flexible (and more complicated), others could be simpler.

But I hope this will give you some food for thought at least :slight_smile:


1 Like


Thanks for taking time to share this detailed scenario. By the way, I explored your YouTube channel first thing to see if I find something related to this. :slight_smile:

I think, the above suggestion can work. What I was doing, was that I have one collection for Questions, and other collection for Answers which relate to questions to start with. Then I have another collection which is like UserAnswers, which related to questions and answers and user.

However, the way you’re structuring is much better. As I’ll have fix number of answers like 3 or 4 so I can add answer options in the same table as questions and then having three toggles or true/false properties in the answers table will help make it easier to handle. I think is something similar to your tutorial about toggles where only one toggle is selected. :slight_smile:

I’ll give it a try and let you know how it goes.

1 Like


Thanks for the hint. I’ll check it out.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.