Looking for one item in a list

Hello everyone,

I am trying to build a quiz template in bubble. Basically, the professor will ask a question, suply the potential responses and then select which is correct. Here is the form he/she will fill out.
image

My issue is demonstrating to the database which the correct answer is. Here is what my workflow looks like.


My question is what is the standard on bubble for finding and selecting a specific item from a list of items?

Thanks

The drop down menu lists
A.)
B.)
C.)
D.)

and the list of questions is
A.) + input A
B.) + input B
…
so I the values do overlap in that way

Hi there,

I think there are a few ways you could tackle this. If you’re willing to limit the number of choices to something pre-determined - so 4, 6, 10, etc. instead of a dynamic number - then you should be able to solve your problem without too much hassle.

Option A: use the find & replace operator

-When you go to populate the “Correct Answer” field in your create new Professor Question workflow, refer to your correct answer input/dropdown [the one with A.) / B.) / C.) / D.)]
-Select correct answer dropdown’s value and then click “More…” and then select the “:find & replace” operator
-Under “Text to find” put A.)
-Under “Replace by” put Input A’s value
-Next, add another “find & replace” and similarly use B.) and Input B’s value
-Do this for every option. Your workflow will save the value based on which option the professor has selected from the dropdown

Option B: use a hidden input

-Add another basic input to your page. Let’s call it “Hidden input.” You can make this one hidden so it doesn’t mess up your UI
-Add a conditional to your input.
-For the “When” put Dropdown Correct Answer’s value is “A.)”
-For the property to change select “Initial content” and put Input A’s value
-Do this for every option
-When you go to set the “Correct answer” field in your workflow, simply refer to Hidden input’s value. Because your hidden input is set up to change its value conditionally, your workflow will save a value based on which option the professor has selected from the Correct answer dropdown


46%20PM

Does this all make sense? And does this answer your question?

If you are wanting to allow your professor to select a variable number of options, this will make things a bit more complicated. You’d likely need to have a separate data type for multiple choice options. Happy to talk through this solution if needed!

Happy Bubbling!

David
AirDev - Custom Software for Everyone

1 Like