You are here

function search_files_helper_add_form_validate in Search Files 6.2

Same name and namespace in other branches
  1. 7.2 search_files.module \search_files_helper_add_form_validate()

validates uniqueness of directory

File

./search_files.module, line 419
Used to index files in attachments and directories

Code

function search_files_helper_add_form_validate($form, $form_state) {
  $name = $form_state['values']['search_files_name'];
  $sql = "SELECT * FROM {search_files_helpers} WHERE name = '%s'";
  $result = db_query($sql, $name);
  while ($row = db_fetch_object($result)) {
    form_set_error("search_files_helper", t('Helper name already in list'));
  }
  $extension = $form_state['values']['search_files_extension'];
  $sql = "SELECT * FROM {search_files_helpers} WHERE extension = '%s'";
  $result = db_query($sql, $extension);
  while ($row = db_fetch_object($result)) {
    form_set_error("search_files_helper", t('Extension already in list'));
  }
}