You are here

function pet_user_form_validate in Previewable email templates 7

Same name and namespace in other branches
  1. 6 pet.admin.inc \pet_user_form_validate()

Validate PET form.

File

includes/pet.admin.inc, line 333
Contains pages for creating, editing, and deleting previewable email templates (PETs).

Code

function pet_user_form_validate($form, &$form_state) {
  $step = empty($form_state['storage']['step']) ? 1 : $form_state['storage']['step'];
  if ($step == 1) {
    $errors = pet_validate_recipients($form_state, $recipients);
    if (!empty($errors)) {
      form_set_error('recipients', '<ul><li>' . implode('</li><li>', $errors) . '</li></ul>');
    }
    else {

      // Save recipients to avoid redundant processing on form submit
      $form_state['storage']['recipients'] = $recipients;
    }
    $errors = pet_validate_emails($form_state['values']['cc']);
    if (!empty($errors)) {
      form_set_error('cc', '<ul><li>' . implode('</li><li>', $errors) . '</li></ul>');
    }
    $errors = pet_validate_emails($form_state['values']['bcc']);
    if (!empty($errors)) {
      form_set_error('bcc', '<ul><li>' . implode('</li><li>', $errors) . '</li></ul>');
    }
  }
}