I have four questions on one page each with a submit button giving feedback. I have disabled the next button and added onshowsetstate to this with each question (from the reserved list) added and the relationship set to “is correct” but this doesn’t work. What have I done wrong?
Hi Pip – This is something I’ve done quite often with my courses. It may be easier to create a variable that adds to a count each time a question is answered correctly. For example on each Submit button, you could add (in this order; X=the number of questions on the page):
onClick Modify Variable “questions_correct” -> Add to variable “1” IF Question_0001 is correct.
onClick Change State -> Next -> enable IF “questions_correct” = “X”
onClick Change State -> Submit IF question_ooo1 is correct
You may also want to change the onShow Set State action to account for a person having already visited a page. For example,
onShow Set State -> Next -> disabled IF “questions _correct” < “X” ELSE Set State -> Next -> enabled
onShow Set State -> Submit button 1 -> disable IF questions_correct = “X” (duplicate for each submit button)
I’ve attached a sample with 3 questions that includes feedback for each question set up via the question itself. Hope this helps!
if you attach an On:Show action to the next button, this action will be run when the button is shown, i.e. for an initially visible button, when the page is loaded. This action won’t change the state of the button while the user is on the page answering the questions but it should change the state if a user returns to the page unless you reset the questions.
Copy the action to each Submit button “On: Click” and you should be fine.