Validation and Submission
Required Email Validation
Browser Constraints
A join form adds an email input with built-in browser constraints before exposing the submit action.
Program
HTML form constraints are declarative. The browser can validate an email field before the request is submitted.
required_email_validation.html
<form action="/join" method="post">
<label for="email">Email</label>
<input id="email" name="email" type="email" required>
<button>Join</button>
</form>
type email
The email input type asks the browser to validate email-shaped text.
required
The required attribute prevents an empty value from passing constraint validation.