You are here

public function QuizQuestionResponse::getReportFormValidate in Quiz 7.5

Same name and namespace in other branches
  1. 6.4 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getReportFormValidate()
  2. 7.6 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getReportFormValidate()
  3. 7 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getReportFormValidate()
  4. 7.4 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getReportFormValidate()

Get the validate function for the reportForm.

Parameters

array $element: The form element of this question.

array $form_state: The FAPI form_state array.

File

question_types/quiz_question/quiz_question.core.inc, line 807
Classes used in the Quiz Question module.

Class

QuizQuestionResponse
Each question type must store its own response data and be able to calculate a score for that data.

Code

public function getReportFormValidate(&$element, &$form_state) {

  // Check to make sure that entered score is not higher than max allowed
  // score.
  if ($element['score']['#value'] && $element['score']['#value'] > $this
    ->getMaxScore(TRUE)) {
    form_error($element['score'], t('The score needs to be a number between 0 and @max', array(
      '@max' => $this
        ->getMaxScore(TRUE),
    )));
  }
}