Contact Form 7
Email validation field (2 posts)

  1. johnmartelle
    Posted 2 years ago #

    I was recently using checkmail validation for contact form 7 plugin to add another email that validated that both email fields were the same value. As of the 3.6 update that plugin no longer works. Is there a way I could add this functionality into your plugin?


  2. johnmartelle
    Posted 2 years ago #

    I have written this code to try and validate that two fields have the same value but it doesn't seem to work.

    add_filter( 'wpcf7_validate_email', 'email_validate', 10, 2);
    add_filter( 'wpcf7_validate_email*', 'email_validate', 10, 2);
    function email_validate($result, $tag){
    	$type = $tag['type'];
    	$name = $tag['name'];
    	if ( 'email' == $type){
    		$email1 = $_POST['email1'];
    		$email2 = $_POST['email2'];
    		if ($email1 !== $email2){
    			$result['valid'] = false;
    			$result['reason'][$name] = "Emails do not match";
    	return $result;

    Any help?

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Contact Form 7
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.