3

I'm not using the Quiz module; I am using Webform and Drupal 7.

I have created a quiz that, if passed, assigns the user a new role. Currently, I use validation rules to simply prevent wrong answers from validating; all questions must be answered correctly before the user can proceed.

I need to change this to allow users with a score of 80% or higher to proceed to the next quiz. I know that I can do that with the quiz module. However I also need to be able to show correct answers for missed questions only to users who scored between 80% and 100%. Those scoring below 80% may not see any answer key.

What is the best way to go about this?

2 Answers 2

2

I am solving this problem by disabling Quiz and using only Webform, and writing a custom module that does the following:

  • use hook_form_alter to catch webform submissions
  • compare them to fields in an answer key
    • answer keys are of content type 'answer key'
    • they have a node reference field that references a webform
  • calculate percent that match
  • display a message depending on score
    • if 80% < x < 100% display answers
    • if 80% < x return that the quiz was passed
    • if 80% > x tell them they failed and redirect them back to the quiz page to re-take the test.
2

Just an FYI I put together a webform quiz module that works with the formbuilder module. It allows you to put in a percentage that the user needs to pass to finish this quiz as well as putting a correct answer for each form component: http://drupal.org/sandbox/acouch/1817016

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.