You are here

function mass_contact_mail_page_validate in Mass Contact 7

Same name and namespace in other branches
  1. 5.2 mass_contact.module \mass_contact_mail_page_validate()
  2. 5 mass_contact.module \mass_contact_mail_page_validate()
  3. 6 mass_contact.module \mass_contact_mail_page_validate()

Validates the main Mass Contact mail form.

Parameters

array $form: An associative array containing the structure of the form.

array $form_state: A keyed array containing the current state of the form.

File

./mass_contact.page.inc, line 380
The main form for creating and sending the messages.

Code

function mass_contact_mail_page_validate(array $form, array &$form_state) {
  if (!$form_state['values']['cid']) {
    form_set_error('category', t('You must select a valid category.'));
  }
  if (user_access('mass contact change default sender information') == 1 && !valid_email_address($form_state['values']['mail'])) {
    form_set_error('mass_contact', t('You must enter a valid email address.'));
  }
}