You are here

function uc_wishlist_email_form_validate in UC Wish List 7

Validate function for the wishlist Email form use to send email.

Parameters

array $form: Form array.

array $form_state: Formstate array contains the user submitted values.

Return value

none Returns nothing.

File

./uc_wishlist.pages.inc, line 812
Page callback and functions for wish lists.

Code

function uc_wishlist_email_form_validate($form, &$form_state) {

  // Exploding the emails id of the recpients.
  $emails = explode(',', $form_state['values']['recipients']);
  $emails = array_filter($emails);
  foreach ($emails as $email) {
    $email = trim($email);
    if ($email != '' && !valid_email_address($email)) {

      // Generating error.
      form_set_error('emails', t('%email is not a valid email address', array(
        '%email' => $email,
      )));
    }
  }
}