Support » Plugin: cformsII » Check email address

  • Resolved kitahei



    I need a double query of the mail address. So in concrete terms two fields with the email as content. If the fields do not match, there would be an error message. Is there a solution in cformsII?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author bgermann


    It is not built-in. You can use the cforms2_after_processing_action hook to compare two fields and throw an exception if they do not match.

    Can you explain how this works?

    We use the form, so that parents can register their children. We are a kindergarten. Some parents do not type their email address correctly, the data does not reach us. Therefore, it would be convenient if parents have to specify the email twice (without command / strg V). The probability that an error occurs during the input is then not excluded, but less.

    many Greetings

    1. You can put this hook code to the functions.php

    add_action('cforms2_after_processing_action', function ($cformsdata) {
      wp_mail('', 'my_cforms_logic test', print_r($cformsdata,1), 'From:');

    This will show you the structure of $cformsdata data array which contains the whole form values (the both emails fields)

    2. After that you can change the hook and throw the exception like this

    add_action('cforms2_after_processing_action', function ($cformsdata) {
        if ($cformsdata['data'][email1-...] != $cformsdata['data'][email2-...])
            throw new Exception('email address do not match!');
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Check email address’ is closed to new replies.