Email Validation using wordpress or Elementor forms
-
Hello!
Im looking to validate business emails by filtering common email ids such as @yahoo.com @gmail.com etc.. Im looking to do this with JS as shown in the image.

Been breaking my head over this for over 2 months because there are no plugins that support this functionality(tried dynamicoo, contact 7 etc)
I have tried with contact 7, but it still doesnt filter outlook and yahoo. Here is the code i have used inside Contact7:
function blocked_email_domain($email) {
$blocked = array(‘@gmail.com’, ‘@hotmail.com’, ‘@yahoo.com’, ‘@yahoo.in’,’@msn.com’, ‘@live.com’, ‘@outlook.com’, ‘@microsoft.com’, ‘@zoho.com’, ‘@rediff.com’);
$email = strstr($email, ‘@’);
if(in_array($email, $blocked))
return false;
else
return true;
}function custom_email_validation_filter($result, $tag) {
$type = $tag[‘type’];
$name = $tag[‘name’];
if($name == ‘your-email’) { // Only apply to fields with the form field name of ‘your-email’
$the_value = $_POST[$name];
if(!blocked_email_domain($the_value)){
$result[‘valid’] = false;
$result->invalidate( $tag, ‘You need to provide an email address that isn’t hosted by a free provider.
Please contact us directly if this isn’t possible.’);};
};
return $result;
}
add_filter(‘wpcf7_validate_email’,’custom_email_validation_filter’, 10, 2); // Email field
add_filter(‘wpcf7_validate_email*’, ‘custom_email_validation_filter’, 10, 2); // Required Email fieldNow as a last solution im trying to insert JQuery into elementor! Need help with a new code!
TIA
The site I need help with is [visible only to staff] (email visible only to moderators and staff). It is not hosted by WordPress.com or connected with Jetpack. This site is not linked to my WordPress.com account.
-
Hi there!
I’m afraid we won’t be able to help you here.
Your site is not hosted with WordPress.com. It is a site using the open-source WordPress software (from WordPress.org) but hosted with Siteground.
Because WordPress.com and WordPress.org are two entirely separate entities, we cannot access files or data for sites hosted elsewhere; we can only assist with sites hosted on our servers. You can read more about the differences between WordPress.org software and WordPress.com here:
https://wordpress.com/support/com-vs-org/.I’d suggest posting to the community forums at: https://wordpress.org/support/forums/., folks there may have more experience with custom code which is not permitted on WordPress.com.
- The topic ‘Email Validation using wordpress or Elementor forms’ is closed to new replies.