You are here

function contact_admin_edit_validate in Drupal 6

Same name and namespace in other branches
  1. 4 modules/contact.module \contact_admin_edit_validate()
  2. 5 modules/contact/contact.module \contact_admin_edit_validate()

Validate the contact category edit page form submission.

File

modules/contact/contact.admin.inc, line 80
Admin page callbacks for the contact module.

Code

function contact_admin_edit_validate($form, &$form_state) {
  if (empty($form_state['values']['category'])) {
    form_set_error('category', t('You must enter a category.'));
  }
  if (empty($form_state['values']['recipients'])) {
    form_set_error('recipients', t('You must enter one or more recipients.'));
  }
  else {
    $recipients = explode(',', $form_state['values']['recipients']);
    foreach ($recipients as $recipient) {
      if (!valid_email_address(trim($recipient))) {
        form_set_error('recipients', t('%recipient is an invalid e-mail address.', array(
          '%recipient' => $recipient,
        )));
      }
    }
  }
}