Email Confirmation Field

fluentform_validate_input_item_input_email #

Using this filter you can create an email confirmation field. By default email input name attribute is ’email’ and if you add another email input its name is ’email_1′ . So in this example, we have used these two names for two email field, make sure these match. Here is the following code :

 add_filter('fluentform_validate_input_item_input_email', function($errorMessage, $field, $formData, $fields, $form) {
       	$target_form_id = 2;
        if($form->id != $target_form_id ) { 
			return $errorMessage ; 
		}
        
     
        if( $formData['email'] !=  $formData['email_1']  ){
            $errorMessage=  'Error! Email does not match';
        }
        
        return [$errorMessage];
    }, 10, 5);

Just change your form ID and place this code in your function.php file. You can do the for other fields as well using their respective validation filters.

Powered by BetterDocs

Leave a Reply

Your email address will not be published. Required fields are marked *