You are here

function pet_add_form_validate in Previewable email templates 6

Validate the PET. Could do better callback and token type validation

File

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

Code

function pet_add_form_validate($form, &$form_state) {
  pet_validate_name($form_state['values']['name'], $form_state);
  if (!empty($form_state['values']['from_override'])) {
    if (!valid_email_address($form_state['values']['from_override'])) {
      form_set_error('from_override', t('From address is not a valid email address.'));
    }
  }
  $errors = pet_validate_emails($form_state['values']['cc_default']);
  if (!empty($errors)) {
    form_set_error('cc_default', '<ul><li>' . implode('</li><li>', $errors) . '</li></ul>');
  }
  $errors = pet_validate_emails($form_state['values']['bcc_default']);
  if (!empty($errors)) {
    form_set_error('bcc_default', '<ul><li>' . implode('</li><li>', $errors) . '</li></ul>');
  }
}