You are here

function mailchimp_signup_subscribe_form_validate in Mailchimp 7.4

Same name and namespace in other branches
  1. 7.5 modules/mailchimp_signup/mailchimp_signup.module \mailchimp_signup_subscribe_form_validate()
  2. 7.3 modules/mailchimp_signup/mailchimp_signup.module \mailchimp_signup_subscribe_form_validate()

Validation handler for mailchimp_signup_subscribe_form.

File

modules/mailchimp_signup/mailchimp_signup.module, line 393
Mailchimp Signup module. Allows creation of signup forms integrated with Mailchimp.

Code

function mailchimp_signup_subscribe_form_validate($form, &$form_state) {
  $signup = reset($form_state['build_info']['args']);
  if (count($signup->mc_lists) > 1) {
    foreach ($form_state['values']['mailchimp_lists'] as $list) {
      if ($list['subscribe']) {
        return;
      }
    }
    form_set_error('mailchimp_lists', t("Please select at least one list to subscribe to."));
  }
}