Validating an email address with more than one domain name and eliminating the rest
I would like to validate an email address using more than one specific domain name. My current code (which I found here) for validating an email address with one specific domain name is:
(function (){
var sDomain = "mail.mil";
if(!event.value) return;
var sEnteredDomain = event.value.split("@")[1];
if (typeof sEnteredDomain === "undefined" || sEnteredDomain.toLowerCase() !== sDomain){
event.rc = false;
app.alert("Your email address must end with: " + sDomain, 3);
}
})();
FYI: I am using this code in a PDF form.
