You are here

function long_answer_report_validate in Quiz 8.4

Same name and namespace in other branches
  1. 6.4 question_types/long_answer/long_answer.module \long_answer_report_validate()
  2. 7 question_types/long_answer/long_answer.module \long_answer_report_validate()
  3. 7.4 question_types/long_answer/long_answer.module \long_answer_report_validate()

Validation function for the report form

Parameters

$values: The FAPI $form_state['values']

$form_key: Array key to add errors to

1 string reference to 'long_answer_report_validate'
LongAnswerResponse::getReportFormValidate in question_types/long_answer/lib/Drupal/long_answer/LongAnswerResponse.php
Implementation of getReportFormValidate

File

question_types/long_answer/long_answer.module, line 303
This module defines a long answer question type for quizzes.

Code

function long_answer_report_validate($values, $form_key) {
  $max = (int) $values['max_score'];

  // Check to make sure that entered score is not higher than max allowed score.
  if (isset($values['score']) && !_quiz_is_int($values['score'], 0, $max)) {
    form_set_error($form_key . '][score', t('The score needs to be a number between @min and @max', array(
      '@min' => 0,
      '@max' => $max,
    )));
  }
}