I have created a quiz manually (without using a question object) that has nine checkboxes. The learner needs to gauge their level of burnout by selecting any number of checkboxes. If they select 0 through 2 checkboxes, they are taken to a page that tells them they are at low risk for burnout. If they select 3 through 5 checkboxes they are taken to a page that tells them they are at medium risk for burnout. If they choose between 6 and 9 checkboxes they are taken to a page that tells them they are at a high risk of burnout.
I have set an action to add 1 to a variable (called quizanswers) each time a checkbox is selected and then actions on the Submit button to take them to each page based on how many checkboxes they have selected. All is working perfectly.
But what if someone changes their mind and wants to uncheck an answer? I need to decrease the variable by 1 for every checkbox they deselect. I’m having a devil of a time figuring out how to best do this. When I add a subtract action, of course it cancels out the add action. Might someone be able to advise me please? I just want to be able say “If selected, add 1 to quizanswers variables, if deselected, subract one from quizanswers.” Seems simple enough…?
Easy. Just make the actions conditional: IF [Checkbox_00x IS NOT EMPTY] THEN [add 1 to QuizAnswers] ELSE [subtract 1 from QuizAnswers].
See attached screenshot for how it looks in Lectora. You will have to do it for every checkbox you have.
P.S. You might wonder why the condition says “add 1 if not empty”, shouldn’t it be the other way round? The trick is, when you click a checkbox, it is marked as “not empty” first and Lectora fires all associated actions later. So by the time Lectora checks the box state, it is not empty.