Solice UI
Back to the curriculum

Chapter 2 · HTML & Semantics

Forms and validation

A form is a conversation: the page asks for information, the visitor answers, and the system explains what happened. Clear labels and useful errors matter more than decorative input styling.

Beginner · Lesson 5 of 6 in this chapter

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.

Collecting an email address

  1. A visible label says Email address.
  2. The email input gives mobile keyboards and browsers the right hint.
  3. If submission fails, the error says what to change and focus returns to a useful place.
  • Placeholders do not replace labels.
  • Validate close to the action and explain recovery.
  • Server validation remains necessary even when the browser validates first.