Email field validation
-
Hello,
using this code:
add_filter(
'wpcf7_validate_email*'
,
'custom_email_confirmation_validation_filter'
, 20, 2 );
function
custom_email_confirmation_validation_filter(
$result
,
$tag
) {
??
if
(
'your-email-confirm'
==
$tag
->name ) {
????
$your_email
= isset(
$_POST
[
'your-email'
] ) ? trim(
$_POST
[
'your-email'
] ) :
''
;
????
$your_email_confirm
= isset(
$_POST
[
'your-email-confirm'
] ) ? trim(
$_POST
[
'your-email-confirm'
] ) :
''
;
????
if
(
$your_email
!=
$your_email_confirm
) {
??????
$result
->invalidate(
$tag
,
"Are you sure this is the correct address?"
);
????
}
??
}
??
return
$result
;
}
would it be possibile to make the confirmation e-mail field mandatory to fill in only if the email field is filled in (which is therefore optional)?
Thank you
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Email field validation’ is closed to new replies.