Support » Plugin: Contact Form 7 » Email validation field

  • johnmartelle

    (@johnmartelle)


    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?

    http://wordpress.org/plugins/contact-form-7/

Viewing 1 replies (of 1 total)
  • johnmartelle

    (@johnmartelle)

    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?

Viewing 1 replies (of 1 total)
  • The topic ‘Email validation field’ is closed to new replies.