You are here

public function LongAnswerQuestion::validate in Quiz 6.3

Same name and namespace in other branches
  1. 6.6 question_types/long_answer/long_answer.classes.inc \LongAnswerQuestion::validate()
  2. 6.5 question_types/long_answer/long_answer.classes.inc \LongAnswerQuestion::validate()

Provides validation for question before it is created.

When a new question is created and initially submited, this is called to validate that the settings are acceptible.

Parameters

$node: The node storing the question.

$form: The processed form.

Overrides QuizQuestion::validate

File

question_types/long_answer/long_answer.classes.inc, line 39
Long answer classes.

Class

LongAnswerQuestion
Implementation of QuizQuestion.

Code

public function validate($node, &$form) {

  // Check to make sure that the maximum score is greater-than or equal-to 0.
  $maximum_score = $node->maximum_score;
  if ((int) $maximum_score != $maximum_score || (int) $maximum_score < 0) {
    form_set_error('maximum_score', t('Score must be a positive integer (0 or higher).'));
  }
}