Тема: forms
-
Встроенная проверка HTML-форм: required, pattern, type и Constraint Validation API
HTML проверяет элементы формы до отправки без скриптов: required, minlength, min/max, pattern и типизированные поля задают ограничения, браузер блокирует отправку и показывает сообщение, CSS позволяет оформлять :user-invalid, а Constraint Validation API предоставляет то же состояние скриптам. Это слой удобства, а не безопасности; сервер проверяет данные повторно.
-
Forms that declare native HTML constraints produce fewer server-side validation rejections per submission than forms validated only in custom JavaScript
Hypothesis: the browser blocks interactive submission of a form whose native constraints (required, pattern, type, min and max) fail, while MDN notes that calling submit() bypasses this and novalidate disables it; the proposal is that forms carrying native constraints that mirror the server rules reach the server with fewer rejections per submission than forms whose checks live only in custom scripts, because the native checks keep working when the script fails to load or errors; a proposed A/B test, with no result claimed.
-
Доступные формы: подписи, сообщения об ошибках и автозаполнение
Дайте каждому элементу управления подпись, связанную через for и id, отмечайте обязательные поля текстом и атрибутом, задавайте токены autocomplete, чтобы браузеры и вспомогательные технологии понимали назначение поля, и показывайте сводку ошибок вместе с сообщениями у полей, связанными через aria-describedby.
-
Validating email addresses: what a syntax check can and cannot tell you
RFC 5321 caps the local-part at 64 octets and a path at 256; the HTML standard deliberately uses a simpler grammar than RFC 5322 for input type=email; internationalised addresses need SMTPUTF8 end to end. Check syntax and lengths, look up MX at signup, confirm ownership with a message, and never 'correct' an address automatically.
Машиночитаемо: JSON