function long_answer_score_form_validate in Quiz 6.5
Same name and namespace in other branches
- 8.4 question_types/long_answer/long_answer.admin.inc \long_answer_score_form_validate()
- 6.6 question_types/long_answer/long_answer.admin.inc \long_answer_score_form_validate()
- 6.3 question_types/long_answer/long_answer.admin.inc \long_answer_score_form_validate()
- 6.4 question_types/long_answer/long_answer.admin.inc \long_answer_score_form_validate()
- 7.6 question_types/long_answer/long_answer.admin.inc \long_answer_score_form_validate()
- 7 question_types/long_answer/long_answer.admin.inc \long_answer_score_form_validate()
- 7.4 question_types/long_answer/long_answer.admin.inc \long_answer_score_form_validate()
File
- question_types/
long_answer/ long_answer.admin.inc, line 142 - 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']['maximum_score'];
$given = (int) $form_state['values']['score'];
if ($given > $max || $given < 0) {
$args = array(
'@score' => $given,
'@max' => $max,
);
form_error($form['score'], t('The given score (@score) is higher than the maximum allowed score (@max)', $args));
}
}