You are here

function suggestion_admin_search_form_validate in Autocomplete Search Suggestions 7

Validation function for the suggestion search form.

1 string reference to 'suggestion_admin_search_form_validate'
suggestion_admin_search_form in ./suggestion.admin.inc
Menu callback to index suggestions.

File

./suggestion.admin.inc, line 240
Administration form for suggestion module.

Code

function suggestion_admin_search_form_validate($form, &$state) {
  $suxs = FALSE;
  if (!count((array) $state['values']['src'])) {
    form_set_error('src', t('The source must have a value.'));
  }
  elseif (isset($state['values']['src'][0]) && count((array) $state['values']['src']) > 1) {
    form_set_error('src', t('The disabled option cannot be combined with other options.'));
  }
  foreach ((array) $state['values']['list'] as $val) {
    if ($val) {
      $suxs = TRUE;
      break;
    }
  }
  if (!$suxs) {
    form_set_error('list', t('You must select an ngram to perform the update to.'));
  }
}