Streaming live at 10am (PST)

Question & Answer Quiz using CMS items

Here’s one I can’t figure out:

Trying to build a quiz in Webflow that asks a question and has 4-5 choices (pulled from a CMS). The choices need to be randomized, otherwise the right answer is always in the same place. Only one answer is right and when selected, it can take you to another question. Any clever ideas?


Hey @caleb Nice idea! What are you asking? How to randomise the order? Or how to make the whole thing work?

Just curious how to make the whole thing work given:

-Pull from CMS (not static questions / answers)
-Randomize answers
-Item Success / Item Failure selection (clever way to signify success and move to next question)

I think I have a solution but it requires randomizing the order of a reference field:

CMS Collection Quiz
Field 1: Question (text field)
Field 2: Answer Correct (reference field)
Field 3: Answer Incorrect (reference field)
Field 4: Answer Incorrect (reference field)

Reference CMS Collection
Field 1: Answer Name (Text field)
Field 2: Link (success)

I added a randomize order with the following script (thanks to Anna) using mixitup and applying this code to randomize:

var mixer = mixitup(containerEl, {
behavior: {
    liveSort: true
},
load: {
    sort: 'random'
}

});

Cool! Did this work? Will be good to see this in action Caleb.