You are here

function taxonomy_manager_tree_validate in Taxonomy Manager 5

Same name and namespace in other branches
  1. 6.2 taxonomy_manager.module \taxonomy_manager_tree_validate()
  2. 6 taxonomy_manager.module \taxonomy_manager_tree_validate()
  3. 7 taxonomy_manager.module \taxonomy_manager_tree_validate()

validates submitted form values checks if selected terms really belong to initial voc, if not --> form_set_error

if all is valid, selected values get added to 'selected_terms' for easy use in submit

Parameters

$form:

File

./taxonomy_manager.module, line 1984
Taxonomy Manager

Code

function taxonomy_manager_tree_validate($form) {
  $selected = array();
  $selected = _taxonomy_manager_tree_get_selected_terms($form['#value']);
  $vid = $form['#vid'];
  foreach ($selected as $tid) {
    if (!_taxonomy_manager_tree_term_valid($tid, $vid)) {
      form_set_error('', t('An illegal choice has been detected. Please contact the site administrator.'));
    }
  }
  form_set_value($form['selected_terms'], $selected);
}