Contact Form 7: Is there a "Confirm Email Address" input type?

I am using the Contact Form 7 Wordpress plugin to add contact forms to a website. The form should have a second field for the user's email address, which is compared with the contents of the first to catch any typos. This is a very common element of contact and registration forms.

Is there a Contact Form 7 tag that can be used to implement this type of function? If not, can anyone who modified the plugin for this point me to the side of the solution?

+6
source share
3 answers

Note this: http://wordpress.org/plugins/checkmail-validation-for-contact-form-7/

According to them:

Verify Email Verification for Contact Form 7 Add a double validation email field to the form and verify email compliance using CF7 Ajax validation.

Double check email This plugin adds a new field to contact form 7 called "Checkmail", which allows you to double check email when you submit the form. The new field will ask users to confirm their email by entering it in the second field.

If you want to do this on your form, you need to add the "Checkmail" field to the CF7 form and enter the name of the email field that you want to check. Validation is done using the CF7 Ajax style: when you submit the CF7 form, the email will be double-checked if it does not match the return error, and ask users to verify the email addresses.

+4
source

I was looking for exactly this and earned from me in another way. Make two fields as shown below in the contact form field-7.

[email* email placeholder "Email"] [email* email-confirm placeholder "Confirm Email"] 

Copy / Paste the following PHP code into the functions.php file

 function register_scripts() { if ( !is_admin() ) { // include your script wp_enqueue_script( 'email-confirm', get_bloginfo( 'template_url' ) . '/js/email-confirm.js' ); } } add_action( 'wp_enqueue_scripts', 'register_scripts' ); 

Be sure to change the path to the file so that it matches and loads the js file with the code below into this path directory.

  // First we trigger the form submit event jQuery( document ).ready( function () { jQuery('.wpcf7-submit').click(function () { // We remove the error to avoid duplicate errors jQuery('.error').remove(); // We create a variable to store our error message var errorMsg = jQuery('<span class="error">Your emails do not match.</span>'); // Then we check our values to see if they match // If they do not match we display the error and we do not allow form to submit if (jQuery('.email').find('input').val() !== jQuery('.email-confirm').find('input').val()) { errorMsg.insertAfter(jQuery('.email-confirm').find('input')); return false; } else { // If they do match we remove the error and we submit the form jQuery('.error').remove(); return true; } }); } ); 

I used it on my website and worked great. Hope this helps someone like me.

Link: Contact Form 7 Verify Email Address

+3
source

The plugin now has an official tutorial for this:

http://contactform7.com/2015/03/28/custom-validation/

+3
source

Source: https://habr.com/ru/post/889882/


All Articles