Labels explain the request
Each input needs a label that remains available while someone types. The input type should match the data, and optional help should explain format or consequence before an error occurs.
Validation helps someone recover
Browser constraints can catch simple missing or malformed values, while the server must still validate submitted data. An error should identify the field, explain the correction, and preserve other valid work.
A familiar example
Collecting an email address
- A visible label says Email address.
- The email input gives mobile keyboards and browsers the right hint.
- If submission fails, the error says what to change and focus returns to a useful place.
What to remember
- Placeholders do not replace labels.
- Validate close to the action and explain recovery.
- Server validation remains necessary even when the browser validates first.