You are here

function flag_lists_form_validate in Flag Lists 7

Same name and namespace in other branches
  1. 6 flag_lists.admin.inc \flag_lists_form_validate()
  2. 7.3 flag_lists.admin.inc \flag_lists_form_validate()

Validate a list.

File

./flag_lists.admin.inc, line 214
Contains administrative pages for creating, editing, and deleting flag lists.

Code

function flag_lists_form_validate($form, $form_state) {

  // Ensure 255 charactor or less name.
  if (drupal_strlen($form_state['values']['title']) > 255) {
    form_set_error('name', t('The @name title may only be 255 characters long.', array(
      '@name' => variable_get('flag_lists_name', t('list')),
    )));
  }

  // Ensure the machine name is unique.
  if (!$form_state['values']['edit']) {
    if (flag_lists_title_exists($form_state['values']['title'], $form_state['values']['type'])) {
      form_set_error('title', t('You already have a @name with this name for this type of content.', array(
        '@name' => variable_get('flag_lists_name', t('list')),
      )));
    }
  }
}