Explore the community Forums Lectora Lectora Questions & Answers Checkboxes – unchecking answers and variables

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #297104 Score: 0
    Profile photo of jsg89
    jsg89
    Member
    @jsg89

    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…?

    #297109 Score: 1
    Profile photo of Sergey Snegirev
    Sergey Snegirev
    Member
    contributor
    intermediate
    advanced
    friend finder
    lab member
    junior moderator
    advocate
    LUC16
    LUC16 Attendee
    wise owl
    333 pts
    @ssneg

    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.

    This post has received 1 vote up.
    #297114 Score: 0
    Profile photo of jsg89
    jsg89
    Member
    @jsg89

    Thanks! That seems to have done the trick!!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.