Students build a form from linked labels, boxes and a button, and find out that a form collects answers but does nothing with them on its own.
Load these into Waypoints Prepare: choose Load URL and paste the copied address, or download the file and import it. In Prepare, the worksheet's Teacher edition shows the answers; the student copy hides them.
Predict and Run 10 min · Investigate 12 min · Modify 10 min · Mix it up 5 min · Make 8 min
Read the unit primer "Parts of a page in 5 minutes", then do the Make task yourself (about 5 minutes).
The surprise for students: pressing Send does nothing. The playground shows a note saying so. A form is only the front: code behind it (JavaScript in the page, or a program on a server) has to collect what was typed and do something with it. That gap is the doorway to the JavaScript courses later. A label is linked to its box when the label's for matches the box's id: clicking the label then puts the cursor in the box, and screen readers read the label aloud for that box.
Each label and its box sit in a <p> so that every field starts on its own line. Making a form look like a card is Course B.
id="mail" where the label says email.On the slides at these points. Students can do the whole lesson on their own; these are for the room. In the deck, the Run, Modify and Make slides have the live playground in them (the tutorial link is the backup), and the notes above are in each slide's speaker notes.
With your partner, decide what happens to the name when someone presses Send. Hold up 1, 2, 3 or 4 fingers for your answer.
Count the votes before running. Ask what would have to exist for the name to arrive anywhere: that is the code behind the form.
Swap forms with a partner. Click every label. For any that fail, say which for and id do not match.
Listen for students who look at where the label sits instead of at the for and the id.
A form that does nothing, and labels linked by matching for and id. Let them click each label to test it, and ask which pair does not match.
| What you will see | A question to ask | The fix |
|---|---|---|
| Clicking a label does nothing. | Does the label's for match the box's id exactly? | Make them identical, for example for="email" and id="email". |
| Two fields run together on one line. | Is each label and its box inside its own paragraph? | Wrap each label and its box in <p> and </p>. |
| The drop-down is empty or shows tags as text. | Is every choice between <option> and </option>, inside the select? | Put each choice in its own <option> inside <select> and </select>. |
One possible solution for each task. Other correct programs are fine.
<form>
<p><label for="name">Name</label>
<input id="name" type="text"></p>
<p><label for="email">Email</label>
<input id="email" type="email"></p>
<button>Join</button>
</form>
<form>
<p><label for="name">Name</label>
<input id="name" type="text"></p>
<p><label for="email">Email</label>
<input id="email" type="email"></p>
<p><label for="house">House</label>
<select id="house">
<option>Owls</option>
<option>Hawks</option>
<option>Kestrels</option>
</select></p>
<button>Join</button>
</form>
Open task: any program that does what the step asks.
<h2>Join the choir</h2>
<form>
<p><label for="name">Name</label>
<input id="name" type="text"></p>
<p><label for="year">Year</label>
<select id="year">
<option>Year 7</option>
<option>Year 8</option>
</select></p>
<p><label for="part">Voice part</label>
<select id="part">
<option>Soprano</option>
<option>Alto</option>
<option>Not sure yet</option>
</select></p>
<button>Join</button>
</form>
Stretch: Add a type="number" box for age and a textarea for a message. Try type="date" and type="color" and see the boxes the browser builds.
Support: Give students the Modify starter and do the first task together: copy the name paragraph, then change four things (the words, for, id and type).
A sign-up form has a label Email and a box, but clicking Email does nothing. Give the likely cause and the fix.
The label's for does not match the box's id (or is missing). Make them the same, for example for="email" and id="email".
Next is the Course A challenge: a club page with a jump-link menu, sections, a results table and a sign-up form. Course B lays the page out and styles the form as a card.