You are here

function faq_ask_form_validate in FAQ_Ask 8

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

Validation form for the FAQ Ask form.

Verifies that the e-mail entered seems to be a valid e-mail.

1 string reference to 'faq_ask_form_validate'
faq_ask_form_node_faq_form_alter in ./faq_ask.module
Implements hook_form_FORM_ID_alter().

File

./faq_ask.module, line 171
This module is an add-on to FAQ module, allows users to 'ask question'.

Code

function faq_ask_form_validate($form, FormStateInterface &$form_state) {
  $email = $form_state
    ->getValue('faq_email');
  if (isset($email) && 2 < strlen($email)) {
    if (!valid_email_address($email)) {
      $form_state
        ->setErrorByName('email', t('That is not a valid e-mail address.'));
    }
  }
}