Confirm Email Address
-
Hi,
I’m trying to achieve a system whereby the email address is entered twice and the two need to match to validate.
The email address is extremely important for me as I use it to collect payments from customers so I can not afford to lose any customers because of a typo.
I have found this topic: https://premium.wpmudev.org/forums/topic/forminator-pro-forminator-confirm-email-address/#post-1399734
I tried using the following code:
add_filter( 'forminator_custom_form_submit_errors', 'check_form_data', 99, 3 ); function check_form_data( $submit_errors, $form_id, $field_data_array ) { $email1 = $email2 = ''; foreach( $field_data_array as $arr ) { if( $arr['name'] == 'email-1' ) $email1 = $arr['value']; if( $arr['name'] == 'email-2' ) $email2 = $arr['value']; if( '' != $email1 && '' != $email2 ) break; } if( $email1 != $email2 ) { $submit_errors[]['email-2'] = 'The email addresses must match!'; } return $submit_errors; }
I created 2 separate Email address fields (https://ibb.co/6mnxp5c) and added the above code to my child theme’s functions.php (I use a plugin called Code Snippets to edit the functions.php).
But it did not work for me.
Can someone please help me achieve this?
Thanks in advance
The page I need help with: [log in to see the link]
- The topic ‘Confirm Email Address’ is closed to new replies.