I'm attempting to create an email form field that requires a user to enter an email in the [email protected] format but also only allowing business emails to come through (no gmail, yahoo, hotmail, ect.)
I've created 2 field patterns that work independently, but I can't seem to get them to work together.
Requires a [email protected] format
pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$"
Does not allow these free email domains. Business emails only.
pattern="^(?!.*@(?:live|gmx|yahoo|outlook|msn|icloud|facebook|aol|zoho|yandex|lycox|inbox|myway|aim|goowy|juno|(?:hot|[gy]|google|short|at|proton|hush|lycos|fast)?mail)\.\w+$).*$"
Here is my form code:
<form method="POST" action="#">
<input type=hidden name="oid" value="00D70000000KCoG">
<input type=hidden name="retURL"
value="#">
<label for="email">Email</label><input id="email" maxlength="80"
name="email" size="30" type="email"
oninvalid="setCustomValidity('Please enter your business email here.')"
onchange="try{setCustomValidity('')}catch(e){}" pattern="[a-z0-
9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$" required />
<input type="submit" name="submit" value="Submit">
</form>
pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$"and specifyingtype="email"?