Charles Harries

| Stream

Constraint Validation API

I already knew about the Constraint Validation API, but I didn't know that it could replace your JS validation wholesale.

Speaking of forms, have you had a good look at the Constraint Validation API? I'd used this minimally at Komodo, but hadn't had a good look at everything that it can do until it popped back up on Twitter the other day. I'd just been using input.validity.valid and form.reportValidity() but it turns out that the Constraint Validation API can basically replace your entire JavaScript validation framework in like 90% of cases.

Which means that with judicious use of novalidate and just a little bit of JS, you can provide full-featured input validation at a fraction of the cost:

Web Code