You are here

function domain_form_validate in Domain Access 7.2

Same name and namespace in other branches
  1. 6.2 domain.admin.inc \domain_form_validate()
  2. 7.3 domain.admin.inc \domain_form_validate()

Implement domain_form validate hook.

1 string reference to 'domain_form_validate'
domain_form in ./domain.admin.inc
FormsAPI for editing a domain record

File

./domain.admin.inc, line 497
Administration functions for the domain module.

Code

function domain_form_validate($form, &$form_state) {
  $subdomain = $form_state['values']['subdomain'];
  $error_list = array();
  $domain_changed = (bool) strcmp($form_state['values']['subdomain'], $form['domain']['subdomain']['#default_value']);
  if ($domain_changed && !domain_unique_domain($subdomain)) {
    $error_list[] = t('The domain value must be unique.');
  }
  $error = domain_valid_domain($subdomain);
  if (!empty($error)) {
    $error_list[] = $error;
  }
  foreach ($error_list as $error) {
    form_set_error('subdomain', $error);
  }
}