Creating forms in HTML is always a bit complicated. You first need to write the HTML markup correctly, then you need to ensure that each form item has a usable value before submitting, and finally you need to alert the user when there is a problem.
Fortunately, HTML5 has introduced some new features that make this task much easier. In particular, form controls have been extended to support constraints, allowing the browser to validate form content on the client side without using JavaScript.
WebKit already has partial support. It's now possible to use properties on a form control to describe constraints, and then use the checkValidity() API in JavaScript to query the validity of a form control and the entire form input. It is also possible to use the ValidityState API to understand which constraint was violated.
However, WebKit did not previously support interactive HTML form validation, which would occur when the form is submitted (unless the novalidate attribute is set on the