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 fields, to 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 = 8;
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 this for other fields as well such as the password fields using their respective validation filters. For the password field, the filter will be ‘fluentform/validate_input_item_input_password’ and the name attributes password fields which are by default ‘password’ and ‘password_1’.
Check all the input filter hooks in this page fluentform/validate_input_item_input_text.