Forms that people can complete

Connect labels and controls and use native validation.

Difficulty
beginner
Time
50 minutes
Last verified
9/21/2026

What you will build

Add a keyboard-usable feedback form with clear validation.

Understand the idea first

Every control needs a stable name, a suitable type, and helpful constraints.

Build it step by step

<form action="/thanks" method="post">
  <fieldset>
    <legend>Suggest an improvement</legend>
    <label for="name">Name</label><input id="name" name="name" required />
    <label for="email">Email</label
    ><input id="email" name="email" type="email" />
    <label for="message">Suggestion</label
    ><textarea id="message" name="message" minlength="10" required></textarea>
    <button type="submit">Send</button>
  </fieldset>
</form>
  1. Place the form at the end of main.
  2. Click labels and verify focus moves correctly.
  3. Test empty and malformed submissions.
  4. Complete it with only the keyboard.

Read the important lines

  • name labels submitted data; id connects a label.
  • Fieldset and legend name a group.
  • Use native types and constraints first.

Common mistakes and what to check

SymptomWhat to check
Placeholder without labelThe stable name is missing.
Button type omittedState whether it submits.
Clickable divUse a real button.

Practice without copying

Add a stage select and a labelled public-display checkbox.

Check the answer after you try

Use select/options and a checkbox with matching label for/id.

Completion check

  • My page contains the required new content
  • I can explain the key tags or attributes without the answer
  • I deliberately created and fixed at least one error

Your privacy choices

Necessary storage is always on. Optional analytics and support services load only after consent.