You are here

function faq_ask_form_validate in FAQ_Ask 6.2

Same name and namespace in other branches
  1. 8 faq_ask.module \faq_ask_form_validate()
  2. 7 faq_ask.module \faq_ask_form_validate()

Validation form for the FAQ Ask form Thanks to http://hokuten.net/2010/drupal-creating-an-e-mail-subscription-block/

1 string reference to 'faq_ask_form_validate'
faq_ask_form_alter in ./faq_ask.module
Implementation of hook_form_alter(). This is how we build the "ask question" form.

File

./faq_ask.module, line 313
This module is an add-on to the FAQ module that allows users with the 'ask question' permission to create a question which will be queued for an 'expert' to answer.

Code

function faq_ask_form_validate($form, &$form_state) {
  if (isset($form_state['values']['faq_email'])) {
    $email = $form_state['values']['faq_email'];
    if (strlen($email) > 1 && !eregi('^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\\.([a-zA-Z]{2,4})$', $email)) {
      form_set_error('email', t('That is not a valid e-mail address.'));
    }
  }
}