Notification Bar
Enjay Gurukul
Learn, Certify & Excel, With Our Micro-Learning Courses
Explore Now
document.addEventListener('DOMContentLoaded', function () { console.log("Enhanced email validation script loaded...");// Function to check if the URL contains a specific query parameter function isCodeParameterPresent() { const urlParams = new URLSearchParams(window.location.search); return urlParams.has('code'); }// List of commonly known personal email domains const blockedDomains = [ 'gmail.com', 'yahoo.com', 'hotmail.com', 'outlook.com', 'aol.com', 'rediffmail.com', 'mail.com', 'protonmail.com', 'zoho.com', 'icloud.com', 'yandex.com', 'live.com', 'msn.com', 'gmx.com', 'ymail.com' ];// Function to check for fuzzy matches function isBlockedDomain(email) { const domain = email.split('@')[1]?.toLowerCase() || ''; return blockedDomains.some(blocked => getSimilarity(blocked, domain) >= 0.8); }// Function to calculate string similarity (for typos like "gmale.com") function getSimilarity(str1, str2) { let longer = str1, shorter = str2; if (str1.length < str2.length) { longer = str2; shorter = str1; } const longerLength = longer.length; if (longerLength === 0) return 1.0; return (longerLength - editDistance(longer, shorter)) / parseFloat(longerLength); }function editDistance(s1, s2) { const costs = []; for (let i = 0; i <= s1.length; i++) { let lastValue = i; for (let j = 0; j <= s2.length; j++) { if (i === 0) costs[j] = j; else if (j > 0) { let newValue = costs[j - 1]; if (s1.charAt(i - 1) !== s2.charAt(j - 1)) newValue = Math.min(newValue, lastValue, costs[j]) + 1; costs[j - 1] = lastValue; lastValue = newValue; } } if (i > 0) costs[s2.length] = lastValue; } return costs[s2.length]; }// Function to validate email function validateEmail(emailField, submitButton) { const email = emailField.value.trim(); const isInvalid = isBlockedDomain(email);if (isInvalid) { emailField.setCustomValidity('Please provide your work email.'); emailField.nextElementSibling.style.display = 'block'; submitButton.disabled = true; } else { emailField.setCustomValidity(''); emailField.nextElementSibling.style.display = 'none'; submitButton.disabled = false; } }// Check if the "code" parameter is present const codeParameterPresent = isCodeParameterPresent();// Attach validation logic to Elementor forms only if "code" parameter is not present if (!codeParameterPresent) { document.querySelectorAll('.elementor-form').forEach(function (form) { const emailField = form.querySelector('input[type="email"]'); const submitButton = form.querySelector('button[type="submit"]');if (emailField && submitButton) { // Add a message below the email field if (!emailField.nextElementSibling || emailField.nextElementSibling.tagName !== 'DIV') { const warningMessage = document.createElement('div'); warningMessage.style.color = 'red'; warningMessage.style.fontSize = '14px'; warningMessage.style.marginTop = '5px'; warningMessage.textContent = 'Please provide your work email.'; warningMessage.style.display = 'none'; emailField.insertAdjacentElement('afterend', warningMessage); }// Validate on input change emailField.addEventListener('input', function () { validateEmail(emailField, submitButton); });// Validate again before submission submitButton.addEventListener('click', function (e) { validateEmail(emailField, submitButton); if (submitButton.disabled) { e.preventDefault(); } }); } }); } else { console.log("Validation disabled due to 'code' parameter in URL."); } });

Sangam CRM: Certified CRM Partners

List of our Certified Sangam CRM Partners: CRM Sales Partners & CRM Implementation Partners
Aditi IT Software Solutions

Vikas Sawarkar – Aditi IT Software Solutions

Aditi IT Software Solutions is an IT Service & IT
5.0
Sanket Systems

Vijay Agarwal – Sanket Systems

Sanket Systems is an IT Service and IT Consulting firm
5.0
Reliable Enterprises

Suhas Marathe – Reliable Enterprises

Reliable Enterprises is IT Services and IT Consulting firm based
0.0
Spectra Computers

Sandeep Thorat – Spectra Compunet

Spectra Compunet is an IT Service and IT Consulting firm
0.0
Aashray Infratech Solutions

Rajesh Agrawal – Aashray Infratech Solutions

Aashray Infratech Solutions is an IT Service & IT Consulting
0.0
Jiyan Infosoft Pvt. Ltd.

Rahul Rafaliya – Jiyan Infosoft Pvt. Ltd.

Jiyan Infosoft Pvt. Ltd. is an IT Service & IT
5.0
Soham Technologies

Prakash Galinde – Soham Technologies

Soham Technologies is an IT Service & IT Consulting Firm
5.0
Answer Computer India-Logo

Nitin Sheth – Answer Computer India PVT LTD

Nitin Sheth is an IT Service and IT Consulting firm
0.0
Comp U Graphics

Nikhil Bhagat – Comp U Graphics

Comp U Graphics is an IT Service and IT Consulting
0.0
HK Software

Kashyap Patel – HK Software

HK Software is a Training and Coaching Institute based in
0.0
Binary Informatic

Jasmin Shah – Binary Informatic

Binary Informatics is an IT Service and IT Consulting firm
4.0

Gaurang Bhatt – Gaj Data Solutions LLP

Gaj Data Solutions LLP is IT Service & IT Consulting
0.0
Skytech Technologies

Dhaval Lotia – Skytech Technologies

Skytech Technologies is an IT Service & IT Consulting Firm
5.0
DG Disha

Binaya Maharana – DG DISHA

DG Disha is an IT Service & IT Consulting Firm
0.0
Global Office Automation

Bharat Lathia – Global Office Automation

Global Office Automation is an IT Service and IT Consulting
0.0
BRL Tech Labs

Aditya Ramkishor – BRL Tech

BRL Tech is IT Service & IT Consulting Firm based
5.0

Book a demo