public function MultichoiceResponse::isValid in Quiz 6.4
Same name and namespace in other branches
- 7 question_types/multichoice/multichoice.classes.inc \MultichoiceResponse::isValid()
- 7.4 question_types/multichoice/multichoice.classes.inc \MultichoiceResponse::isValid()
Implementation of isValid
Overrides QuizQuestionResponse::isValid
See also
QuizQuestionResponse#isValid()
File
- question_types/
multichoice/ multichoice.classes.inc, line 740 - The main classes for the multichoice question type.
Class
- MultichoiceResponse
- Extension of QuizQuestionResponse
Code
public function isValid() {
if ($this->question->choice_multi) {
return TRUE;
}
if (empty($this->user_answer_ids)) {
return t('You must provide an answer');
}
// Perform extra check since FAPI isn't beeing used:
if (count($this->user_answer_ids) > 1) {
return t('You are only allowed to select one answer');
}
return TRUE;
}