CHAPTER 37 · HTML
Guided project: a workshop request form
Build a form in clear steps. Turn requirements into labelled controls, then test missing answers and submitted values.
Download example files (ZIP)The project brief
Step 1: plan each answer
Step 2: save the smallest working version
Step 3: add related groups
Step 4: match rules to the brief
Step 5: test more than a successful entry
Step 6: explain the result honestly
Follow the idea
- 1Write the requirements
- 2Choose labelled controls and names
- 3Add matching constraints
- 4Test valid, invalid and omitted values
The local result page demonstrates a URL, not a real registration.
Complete program: workshop-form-start.html
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Workshop Form First Step</title>
</head>
<body>
<h1>Plan a fictional workshop request</h1>
<p>This is a local form exercise, not a booking. Keep form-result.html beside this file.</p>
<form action="form-result.html" method="get">
<p>
<label for="practice-alias">Practice alias (required)</label>
<input type="text" id="practice-alias" name="alias" required maxlength="30" />
</p>
<p>
<label for="topic">Topic (required)</label>
<select id="topic" name="topic" required>
<option value="">Choose a topic</option>
<option value="links">Links</option>
<option value="forms">Forms</option>
</select>
</p>
<button type="submit">Inspect the practice request</button>
</form>
</body>
</html>This preview shows the example in a browser. Save the complete code in local files to test links between pages and downloads. Same-page section links work here. Form submission is disabled in this preview. Save the example and its result page locally to test submission. Use fictional practice values.
Complete program: workshop-form-complete.html
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Workshop Form Complete Practice</title>
</head>
<body>
<h1>Prepare a fictional workshop request</h1>
<p>
No place is reserved and no data is stored. Use made-up details and keep form-result.html
beside this file.
</p>
<form action="form-result.html" method="get">
<fieldset>
<legend>Your practice request</legend>
<p>
<label for="alias">Practice alias (required)</label>
<input type="text" id="alias" name="alias" required maxlength="30" />
</p>
<p>
<label for="topic">Topic (required)</label>
<select id="topic" name="topic" required>
<option value="">Choose a topic</option>
<option value="links">Links</option>
<option value="forms">Forms</option>
</select>
</p>
<p id="count-help">Choose 1, 2 or 3 practice sessions.</p>
<p>
<label for="count">Session count (required)</label>
<input
type="number"
id="count"
name="count"
min="1"
max="3"
step="1"
required
aria-describedby="count-help"
/>
</p>
</fieldset>
<fieldset>
<legend>Choose one time (required)</legend>
<p>
<input type="radio" id="morning" name="slot" value="morning" required />
<label for="morning">Morning</label>
</p>
<p>
<input type="radio" id="afternoon" name="slot" value="afternoon" />
<label for="afternoon">Afternoon</label>
</p>
</fieldset>
<p><label for="question">One practice question (optional, up to 200 characters)</label></p>
<p><textarea id="question" name="question" rows="3" cols="28" maxlength="200"></textarea></p>
<p>
<input type="checkbox" id="reminder" name="reminder" value="yes" />
<label for="reminder">Include a practice reminder flag</label>
</p>
<button type="submit">Inspect the practice request</button>
</form>
</body>
</html>This preview shows the example in a browser. Save the complete code in local files to test links between pages and downloads. Same-page section links work here. Form submission is disabled in this preview. Save the example and its result page locally to test submission. Use fictional practice values.
Problem and solution
Common mistakes and useful tips
Do not nest forms. Use invented information in this GET exercise. Do not claim the result sends reminders. Do not replace labels with placeholders. Test invalid answers, keyboard focus and omitted values.
Practice questions
Why plan fields before tags? Which name is shared by the time choices? Why is the first topic value empty? What should happen with count=1.5? What is sent for an unchecked reminder? Build the complete example and run valid and invalid cases. Was a booking made?
Check your practice answers
So every control serves a stated requirement. Slot. Their ids and values differ. Required rejects that empty selection and asks for a real choice. It fails the whole-session step rule. No reminder entry. Invalid constrained values block ordinary submission. Valid values reach a static page; no booking, storage or email occurs.
Interview questions
How do you choose a control?
Why test names as well as appearance?
Why distinguish optional and required?
Does a working form prove a service is complete?
Quick revision
Plan requirements and names. Build a small version first. Test valid, invalid and omitted values. Describe the actual result.