Skip to content

Commit 386c32a

Browse files
committed
improve form semantics with fieldsets, fix syntax error
1 parent 2bb47a3 commit 386c32a

1 file changed

Lines changed: 40 additions & 32 deletions

File tree

Form-Controls/index.html

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,30 @@ <h1>Product Pick</h1>
1515
<form>
1616
<!-- try writing out the requirements first as comments
1717
this will also help you fill in your PR message later-->
18-
<!-- Customer name: required, at least two non-space characters -->
19-
<label for="customer-name">Name</label>
20-
<input
21-
id="customer-name"
22-
name="customer-name"
23-
type="text"
24-
required
25-
pattern=".*\S.*\S.*"
26-
title="Please enter your name, or at least two non-space characters."
27-
/>
28-
<br />
29-
<!-- Customer email: required, valid email format -->
30-
<label for="customer-email">Email</label>
31-
<input
32-
id="customer-email"
33-
name="customer-email"
34-
type="email"
35-
required
36-
/>
37-
<br />
18+
<fieldset>
19+
<legend>Your details</legend>
20+
21+
<!-- Customer name: required, at least two non-space characters -->
22+
<label for="customer-name">Name</label>
23+
<input
24+
id="customer-name"
25+
name="customer-name"
26+
type="text"
27+
required
28+
pattern=".*\S.*\S.*"
29+
title="Please enter your name, or at least two non-space characters."
30+
/>
31+
32+
<!-- Customer email: required, valid email format -->
33+
<label for="customer-email">Email</label>
34+
<input
35+
id="customer-email"
36+
name="customer-email"
37+
type="email"
38+
required
39+
/>
40+
</fieldset>
41+
3842
<!-- T-shirt colour: required, 3 choices -->
3943
<fieldset>
4044
<legend>T-shirt colour</legend>
@@ -54,19 +58,23 @@ <h1>Product Pick</h1>
5458
Blue
5559
</label>
5660
</fieldset>
61+
5762
<!-- T-shirt size: required, XS, S, M, L, XL, XXL -->
58-
<br />
59-
<label for="tshirt-size">T-shirt size</label>
60-
<select id="tshirt-size" name="tshirt-size" required>
61-
<option value="">Select size</option>
62-
<option value="xs">XS</option>
63-
<option value="s">S</option>
64-
<option value="m">M</option>
65-
<option value="l">L</option>
66-
<option value="xl">XL</option>
67-
<option value="xxl">XXL</option>
68-
</select>
69-
<br
63+
<fieldset>
64+
<legend>T-shirt size</legend>
65+
66+
<label for="tshirt-size">Size</label>
67+
<select id="tshirt-size" name="tshirt-size" required>
68+
<option value="">Select size</option>
69+
<option value="xs">XS</option>
70+
<option value="s">S</option>
71+
<option value="m">M</option>
72+
<option value="l">L</option>
73+
<option value="xl">XL</option>
74+
<option value="xxl">XXL</option>
75+
</select>
76+
</fieldset>
77+
7078
<!-- Submit button -->
7179
<button type="submit">Order T-shirt</button>
7280
</form>

0 commit comments

Comments
 (0)