You are here

function add_to_head_edit_profile_validate in Add To Head 6

Same name and namespace in other branches
  1. 7 add_to_head.admin.inc \add_to_head_edit_profile_validate()

Validate handler for the add/edit form

1 string reference to 'add_to_head_edit_profile_validate'
add_to_head_edit_profile in ./add_to_head.admin.inc
This function provides the edit form. The Add Profile form also uses this.

File

./add_to_head.admin.inc, line 124
This file contains all the admin-related callbacks

Code

function add_to_head_edit_profile_validate($form, &$form_state) {
  $settings = variable_get('add_to_head_profiles', array());
  if (preg_match('/[^a-z0-9\\-]/', $form_state['values']['name'])) {
    form_set_error('name', t('The name should only contain lower case letters, numbers and hyphens.'));
  }
  elseif ($form_state['values']['name'] != $form_state['values']['name_orig'] && isset($settings[$form_state['values']['name']])) {
    form_set_error('name', t('This name has already been used. Please try another.'));
  }
}