Disable next button until all questions on page answered correctly

pvalleley3585
pvalleley3585 Community Member Posts: 17
Hi

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?

Regards

Pip

 

Comments

  • jasonadal
    jasonadal Community Member Posts: 450 ♪ Opening Act ♪
    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):
    1. onClick Modify Variable "questions_correct" -> Add to variable  "1" IF Question_0001 is correct.
    2. onClick Change State -> Next -> enable  IF "questions_correct" = "X"
    3. 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,
    1. onShow Set State -> Next -> disabled IF "questions _correct" < "X" ELSE Set State -> Next -> enabled
    2. 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!
  • klaatu
    klaatu Community Member Posts: 986 ☆ Roadie ☆
    Another method (Seem's Tim beat me to the punch) that might be easier and quicker to set up (just duplicate the group and change the variable to modify for each question).

    If you still want to know why what you originally had doesn't work then post it or a similar sample and I/we will look it over and provide feedback.

    Darrel
  • pvalleley3585
    pvalleley3585 Community Member Posts: 17
    Sorry I’m struggling to understand this. How do I send this page to you? Do I export it?  Unfortunately I cannot open the zip file.

    Pip

     
  • timk
    timk Community Member Posts: 1,245 ✭ Legend ✭
    Hi,

    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.

    Tim
  • klaatu
    klaatu Community Member Posts: 986 ☆ Roadie ☆
    Pip, if you save the zip file and then right click it you should have an option to "Extract all".

    To attach a copy for us to look over: Re-publish your non-working project and check create zip file in the options. Attach that zip file to a post.