You are here

function nodewords_custom_pages_edit_validate in Nodewords: D6 Meta Tags 6

Same name and namespace in other branches
  1. 6.2 nodewords_custom_pages/nodewords_custom_pages.admin.inc \nodewords_custom_pages_edit_validate()

Validate function for the meta tags edit page.

File

./nodewords.admin.inc, line 198
Administration interface for nodewords.module.

Code

function nodewords_custom_pages_edit_validate($form, &$form_state) {
  if (trim($form_state['values']['name']) == '') {
    form_set_error('name', t('The name contains only spaces, and other not printable characters.'));
  }
  if (($path = trim($form_state['values']['path'])) != '') {
    $bool = db_result(db_query_range("SELECT 1 FROM {nodewords_custom} WHERE path = '%s' AND pid <> %d", $path, isset($form_state['values']['pid']) ? $form_state['values']['pid'] : 0, 0, 1));
    if ($bool) {
      form_set_error('path', t('The path is already used.'));
    }
  }
  else {
    form_set_error('path', t('The path contains only spaces, and other not printable characters.'));
  }
}