You are here

function user_badges_change_form_validate in User Badges 6.2

Same name and namespace in other branches
  1. 6 user_badges.module \user_badges_change_form_validate()
  2. 7.4 user_badges.module \user_badges_change_form_validate()
  3. 7 user_badges.module \user_badges_change_form_validate()
  4. 7.2 user_badges.module \user_badges_change_form_validate()
  5. 7.3 user_badges.module \user_badges_change_form_validate()

Validate user_badges_remove_form form submissions.

File

./user_badges.module, line 630
@brief User Badges module file

Code

function user_badges_change_form_validate($form, &$form_state) {
  for ($i = 1; $i <= 5; $i++) {
    if (!empty($form_state['values']['add' . $i])) {
      $validation = user_badges_badge_autocomplete_validation($form_state['values']['add' . $i]);
      switch ($validation[1]) {
        case 'nobid':
          form_set_error('add' . $i, t('@value is not a valid badge ID. Try using the autocomplete function (requires javascript).', array(
            '@value' => $validation[0],
          )));
          break;
        case 'string':
          form_set_error('add' . $i, t('"@value" is not a valid badge. Try using the autocomplete function (requires javascript).', array(
            '@value' => $form_state['values']['add' . $i],
          )));
          break;
      }
    }
  }
}