domain_create_form_validate

Definition

domain_create_form_validate($form_id, $form_values)
domain_admin.inc, line 453

Description

FormsAPI for domain_create_form()

Code

function domain_create_form_validate($form_id, $form_values) {
  // TODO: Make this a proper regex?
  $subdomain = strtolower(urlencode($form_values['subdomain']));
  $check = db_result(db_query("SELECT COUNT(domain_id) FROM {domain} WHERE subdomain = '%s'", $subdomain));
  if ($check) {
    form_set_error('subdomain', t('The subdomain value must be unique.'));
  }
  $check = NULL;
  $check = db_result(db_query("SELECT COUNT(domain_id) FROM {domain} WHERE sitename = '%s'", $form_values['sitename']));
  if ($check) {
    form_set_error('sitename', t('The site name value must be unique.'));
  }
}