contact_admin_edit_validate

Versions
4.7 – 5
contact_admin_edit_validate($form_id, $form_values)
6
contact_admin_edit_validate($form, &$form_state)

Validate the contact category edit page form submission.

Code

modules/contact/contact.admin.inc, line 80

<?php
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)));
      }
    }
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.