About the HTML Email Input Generator
Setting type="email" does two useful things at once: mobile keyboards gain the at sign and the dot, and the browser refuses to submit the form until the value looks like an address. The check is deliberately loose. It wants some text, an at sign and a domain part, and that is all, so a@b passes while name@example with a real looking domain but no dot also passes. It is a typo catcher, not proof the mailbox exists.
Tick the multiple option and the field accepts a comma separated list, validating each entry in turn, which suits an invite or share form. Add a pattern when you need to narrow things further, for instance restricting sign ups to one company domain; the pattern is tested in addition to the built in rule, and it is anchored to the whole value automatically. Give the field a title in your own markup to explain the requirement, because that is the text the browser shows when the pattern fails.
The autocomplete="email" attribute lets password managers and browser profiles fill the field in one tap, which measurably reduces abandoned forms and costs one attribute. A placeholder is a hint, never a label, so keep the real label element that this generator emits. Whatever the browser accepts, verify the address on the server and by sending a confirmation message. To test an address list against a stricter rule, use the Email Validator.
How to use
- Set the label, field name and placeholder.
- Turn on required and autocomplete for a real sign up form.
- Tick multiple if the field should take a list of addresses.
- Add a pattern to restrict the domain, then copy the markup.
Common questions
- How strict is the built in validation?
- Loose on purpose. It checks for text, an at sign and a domain part, so it catches typos but never proves the mailbox exists.
- How do I accept several addresses in one field?
- Add the multiple attribute and enter them separated by commas. Each entry is validated individually.
- Can I limit sign ups to one domain?
- Yes, add a pattern such as .+@example\.com and a title explaining the rule, then repeat the check on the server.
- Is a placeholder enough instead of a label?
- No. It disappears as soon as typing starts and is not reliably announced, so keep the label element.