I have a Klaviyo form embedded on my WordPress website using the following code:
<div class="klaviyo-form-xxxxx"></div>
What I want is for the form to accept only work (business) email addresses in the email field. If someone enters a personal email address (like Gmail, Yahoo, Outlook, etc.), the form should display an error message and prevent submission.
Best answer by whereisjad
@mamun_990 you can add client side validation to the form that can occur when users try to submit the form:
function validateEmail() { const email = document.getElementById('email').value; if (email.includes("@gmail.com")) { alert("Gmail addresses are not allowed."); return false; } // You can add other validation checks here return true; }
@mamun_990 you can add client side validation to the form that can occur when users try to submit the form:
function validateEmail() { const email = document.getElementById('email').value; if (email.includes("@gmail.com")) { alert("Gmail addresses are not allowed."); return false; } // You can add other validation checks here return true; }