abuse_report_form_validate

Definition

abuse_report_form_validate($form_id, $form_values)
abuse/abuse.module, line 596

Description

A hook to validate abuse_report_form

Parameters

$form_id self explanatory

$form_values values of the form fields

Code

<?php
function abuse_report_form_validate($form_id, $form_values) {
  if (empty($form_values['name'])) {
    form_set_error('name', t('<em>!field</em> is required', array('!field' => t('from'))));
  }
  if (empty($form_values['mail']) || !valid_email_address($form_values['mail'])) {
    form_set_error('mail', t('a valid email address is required'));
  }
  if (empty($form_values['reason']) && $form_values['op'] != t('cancel')) {
    form_set_error('reason', t('please give a reason'));
  }
}
?>