You are here

function quiz_settings_form_validate in Quiz 5

Same name and namespace in other branches
  1. 5.2 quiz.module \quiz_settings_form_validate()
  2. 6.6 quiz.admin.inc \quiz_settings_form_validate()
  3. 6.2 quiz.admin.inc \quiz_settings_form_validate()
  4. 6.3 quiz.admin.inc \quiz_settings_form_validate()
  5. 6.4 quiz.admin.inc \quiz_settings_form_validate()
  6. 6.5 quiz.admin.inc \quiz_settings_form_validate()
  7. 7.6 quiz.admin.inc \quiz_settings_form_validate()
  8. 7 quiz.admin.inc \quiz_settings_form_validate()
  9. 7.4 quiz.admin.inc \quiz_settings_form_validate()
  10. 7.5 quiz.admin.inc \quiz_settings_form_validate()

Validation form settings form

File

./quiz.module, line 1326
Quiz Module

Code

function quiz_settings_form_validate($form_id, $form_values) {
  if (!is_numeric($form_values['quiz_default_close']) || $form_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_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_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_values['quiz_default_pass_rate'] < 0) {
    form_set_error('quiz_default_pass_rate', t('The pass rate value must not be less than 0%.'));
  }
}