function user_badges_change_form_validate in User Badges 7.3
Same name and namespace in other branches
- 6.2 user_badges.module \user_badges_change_form_validate()
- 6 user_badges.module \user_badges_change_form_validate()
- 7.4 user_badges.module \user_badges_change_form_validate()
- 7 user_badges.module \user_badges_change_form_validate()
- 7.2 user_badges.module \user_badges_change_form_validate()
Validate user_badges_remove_form form submissions.
File
- ./
user_badges.module, line 738 - @brief User Badges module file
Code
function user_badges_change_form_validate($form, &$form_state) {
//If the user used the autocomplete to select badges, validate the text in them
if (variable_get('user_badges_selector_type', 1) == 1) {
for ($i = 1; $i <= 5; $i++) {
if (!empty($form_state['values']['add_autocomplete' . $i])) {
$validation = user_badges_badge_autocomplete_validation($form_state['values']['add_autocomplete' . $i]);
switch ($validation[1]) {
case 'nobid':
form_set_error('add_autocomplete' . $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_autocomplete' . $i, t('"@value" is not a valid badge. Try using the autocomplete function (requires javascript).', array(
'@value' => $form_state['values']['add_autocomplete' . $i],
)));
break;
}
}
}
}
}