Hi, would like to have a form like this one where a user cannot enter gmail, yahoo or hotmail addresses in the email filed.
[url]http://pages.emptoris.com/GatedForm.htm
Have managed to make it work using this code:
<script type=”text/javascript”>
$(document).ready(function() {
$(‘#btn-submit’).click(function() {
$(“.error”).remove();
var hasError = false;
var emailReg = /^([w-.]+@([w-]+.)+[w-]{2,4})?$/;
var emailblockReg =
/^([w-.]+@(?!gmail.com)(?!yahoo.com)(?!hotmail.com)([w-]+.)+[w-]{2,4})?$/;
var emailaddressVal = $(“#UserEmail”).val();
if(emailaddressVal == ”) {
$(“#UserEmail”).after(‘<span class=”error”>Please enter your email address.</span>’);
hasError = true;
}
else if(!emailReg.test(emailaddressVal)) {
$(“#UserEmail”).after(‘<span class=”error”>Enter a valid email address.</span>’);
hasError = true;
}
else if(!emailblockReg.test(emailaddressVal)) {
$(“#UserEmail”).after(‘<span class=”error”>No yahoo, gmail or hotmail emails.</span>’);
hasError = true
}
if(hasError == true) { return false; }
});
});
</script>
My main problem is that i need to integrate it with this other validator but I dont know how, so that it works with the form i have already.
if ($id==3) return “var RegExp=/^((([a-z]|[0-9]|!|#|$|%|&|’|*+–^`|{|||}|~)+(.([a-z]|[0-9]|!|#|$|%|&|’|*|+|-|/|=|?|^|_|{|}*)@((((([a-z]|[0-9])([a-z]|[0-9]|–.–..[.]