I try to build a simple quiz (to use it interactiv in quarto).
I’m looking for a way to neatly left-justify the radio buttons below each other and also put longer questions on the right. My favorite thing would be if I could put the radiobuttons and the “labels” into a table.
| right | wrong | Qestion | answer |
|-------|-------|------------------------|--------|
| o | o | The earth is a planet. | right |
| o | o | The sun is a star. | right |
| o | o | Pluto is a planet. | wrong |
| o | o | Pluto is a star. | wrong |
At this stage I have the inputs in the results:
viewof MC1 = Inputs.form({
rf1_1: Inputs.radio(["right", "wrong"], {label: "The earth is a planet."}),
rf1_2: Inputs.radio(["right", "wrong"], {label: "The sun is a star."}),
rf1_3: Inputs.radio(["right", "wrong"], {label: "Pluto is a planet."}),
rf1_4: Inputs.radio(["right", "wrong"], {label: "Pluto is a star."})
})
Points = {
const Sum =
(MC1["rf1_1"] == "right")*1 +
(MC1["rf1_2"] == "right")*1 +
(MC1["rf1_3"] == "wrong")*1 +
(MC1["rf1_4"] == "wrong")*1
return(Sum)
}