1

I am using the Quiz module and enabled its submodule Short Answer.

How can I insert two answers instead of one?

Note: Multiple choice is fine, but my problem is at Short Answer: I'm only able to add 1 correct answer, but my Quiz question has 2 correct answers.

2
  • If you are talking of marking an answer as correct, that is how I expect it should work, like Stack Exchange works. If you are talking of writing two answers, then that is different.
    – apaderno
    Jun 1, 2016 at 10:40
  • @kiamlaluno, my current situation is one short answer question has one or more answers. Jun 1, 2016 at 11:22

1 Answer 1

0

I guess no solution, so I just hack the module.

/public_html/testserver/the-exaple.com/sites/all/modules/contrib/quiz/question_types/short_answer

public function evaluateAnswer($user_answer) {
  ...
  switch ($this->node->correct_answer_evaluation) {
  case self::ANSWER_MATCH:
    if ($user_answer == $this->node->correct_answer) {
      $score = $this->node->max_score;
    }
    break;
  case self::ANSWER_INSENSITIVE_MATCH:

   ////////////////edit your code here

    break;
  case self::ANSWER_REGEX:
    if (preg_match($this->node->correct_answer, $user_answer) > 0) {
      $score = $this->node->max_score;
    }
    break;
}
...
}

Since I chose my answer is insensitive, I will edit second case.

Your Answer

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

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