You are here

function long_answer_score_form_validate in Quiz 8.4

Same name and namespace in other branches
  1. 6.6 question_types/long_answer/long_answer.admin.inc \long_answer_score_form_validate()
  2. 6.3 question_types/long_answer/long_answer.admin.inc \long_answer_score_form_validate()
  3. 6.4 question_types/long_answer/long_answer.admin.inc \long_answer_score_form_validate()
  4. 6.5 question_types/long_answer/long_answer.admin.inc \long_answer_score_form_validate()
  5. 7.6 question_types/long_answer/long_answer.admin.inc \long_answer_score_form_validate()
  6. 7 question_types/long_answer/long_answer.admin.inc \long_answer_score_form_validate()
  7. 7.4 question_types/long_answer/long_answer.admin.inc \long_answer_score_form_validate()

Validates the long answer score form

File

question_types/long_answer/long_answer.admin.inc, line 154
Administration pages for the long answer questions module.

Code

function long_answer_score_form_validate($form, $form_state) {

  // Check to make sure that entered score is not higher than max allowed score.
  $max = (int) $form_state['values']['rel_max_score'];
  $given = $form_state['values']['score'];
  if (!_quiz_is_int($given, 0, $max)) {
    $args = array(
      '@score' => $given,
      '@max' => $max,
    );
    form_set_error('score', $form_state, t('The given score (@score) must be an integer between 0 and @max', $args));
  }
}