Hi folks,


Requirement: The landing page form( Leadsquared Landing page) should allow one to capture only business email ID’s in one's responsive landing pages. One should be able to block certain domains like gmail, yahoo, etc from making submissions.


Solution: We have this Script in place already in our API docs but it is obsolete: https://apidocs.leadsquared.com/script-to-allow-only-business-email-ids-in-landing-pages/


Here's the Updated script:


<script type="text/javascript">
$(document).ready(function(e) {
// Submit form with id function.
$("#form-submit-button").click(function() {
var emailblockCon =/^([\w-.]+@(?!gmail\.com)(?!yahoo\.com)(?!hotmail\.com)(?!yopmail\.com)(?!test\.com)([\w-]+.)+[\w-]{2,4})?$/;
var Email = $("#EmailAddress").val();
if(!emailblockCon.test(Email)){
window.alert("Please use your business email, we don't accept Gmail, Yahoo, Hotmail accounts.");
return false;
}
});
});
</script>


NOTE: The user should ensure that the Javascript Library should also be added in the Header of the Landing page code as shown below: