You are here

public function MatchingQuestion::getAnsweringFormValidate in Quiz 7.6

Same name and namespace in other branches
  1. 7.5 question_types/matching/matching.classes.inc \MatchingQuestion::getAnsweringFormValidate()

Question response validator.

Overrides QuizQuestion::getAnsweringFormValidate

File

question_types/matching/matching.classes.inc, line 249
matching.classes

Class

MatchingQuestion
Extension of QuizQuestion.

Code

public function getAnsweringFormValidate(array &$form, array &$form_state = NULL) {
  $question_answer = $form_state['values']['question'][$this->node->nid]['answer'];
  foreach ($question_answer as $value) {
    if ($value != 'def') {
      return TRUE;
    }
  }
  form_set_error('', t('You need to match at least one of the items.'));
}