MDL-19101 scale selection validated on category edit form

This commit is contained in:
skodak
2009-05-07 08:47:26 +00:00
parent 79143931ce
commit fedfff27f5
+15
View File
@@ -439,6 +439,21 @@ class edit_category_form extends moodleform {
}
}
}
/// perform extra validation before submission
function validation($data, $files) {
global $COURSE;
$errors = parent::validation($data, $files);
if (array_key_exists('grade_item_gradetype', $data) and $data['grade_item_gradetype'] == GRADE_TYPE_SCALE) {
if (empty($data['grade_item_scaleid'])) {
$errors['grade_item_scaleid'] = get_string('missingscale', 'grades');
}
}
return $errors;
}
}
?>