+1 vote

I want to ask a question using the checkbox format, where the checkboxes offer multiple correct and incorrect answers, then give the user points for each correct answer selected (and subtract points for each incorrect one).

When I just put a "*points: x" line beneath each answer I get the error "Answers to questions of type 'checkbox' cannot have content indented underneath"

What's the correct way to give users points based on their selections of checkboxes? Thanks!


1 Answer

0 votes

Great question!

It is indeed not possible to assign scores to checkbox question by each option as it is evaluated only when Next button is clicked. We can do an easy workaround where we store answers and points for choosing them in a collection; when we have an answer, we add up the scores and update points like this:

--create a collection that hold point scores for each of the answers in the checkbox question:
>> answers_points = {"1" -> 5, "2" -> 5, "3" -> 5, "4" -> 0, "5" -> 0}

*question: Select all numbers less than 4
	*type: checkbox
	*save: answers

--here we look up point answers_points for the answers we recorded and add points:
>> i = 1
*while: i <= answers.size
	>> points = points + answers_points["{answers[i]}"]
	>> i = i + 1

Sample program.

by (5.8k points)
Welcome to Guidedtrack Q&A, where you can ask questions and receive answers from other members of the community.
134 questions
144 answers
40 users