function quiz_settings_form_validate in Quiz 6.2
Same name and namespace in other branches
- 5.2 quiz.module \quiz_settings_form_validate()
- 5 quiz.module \quiz_settings_form_validate()
- 6.6 quiz.admin.inc \quiz_settings_form_validate()
- 6.3 quiz.admin.inc \quiz_settings_form_validate()
- 6.4 quiz.admin.inc \quiz_settings_form_validate()
- 6.5 quiz.admin.inc \quiz_settings_form_validate()
- 7.6 quiz.admin.inc \quiz_settings_form_validate()
- 7 quiz.admin.inc \quiz_settings_form_validate()
- 7.4 quiz.admin.inc \quiz_settings_form_validate()
- 7.5 quiz.admin.inc \quiz_settings_form_validate()
Validation of the Form Settings form.
Checks the values for the form administration form for quiz settings.
File
- ./
quiz.admin.inc, line 312 - Administrator interface for Quiz module.
Code
function quiz_settings_form_validate($form, &$form_state) {
if (!is_numeric($form_state['values']['number_of_random_questions']) || $form_state['values']['number_of_random_questions'] < 0) {
form_set_error('number_of_random_questions', t('The number of random questions must be at least 0.'));
}
if (!is_numeric($form_state['values']['quiz_default_close']) || $form_state['values']['quiz_default_close'] <= 0) {
form_set_error('quiz_default_close', t('The default number of days before a quiz is closed must be a number greater than 0.'));
}
if (!is_numeric($form_state['values']['quiz_default_pass_rate'])) {
form_set_error('quiz_default_pass_rate', t('The pass rate value must be a number between 0% and 100%.'));
}
if ($form_state['values']['quiz_default_pass_rate'] > 100) {
form_set_error('quiz_default_pass_rate', t('The pass rate value must not be more than 100%.'));
}
if ($form_state['values']['quiz_default_pass_rate'] < 0) {
form_set_error('quiz_default_pass_rate', t('The pass rate value must not be less than 0%.'));
}
}