Combine several controls in one form, choosing each with care.
What to build
An order form.
Requirements
- A
selectnamedsizewith options whose values and text are:sSmall,mMedium,lLarge.mis selected from the start. - A number input named
qty, withmin="1"andvalue="1". - A phone input named
phone, of the type meant for phone numbers. - A
textareanamednotewithrows="3". - A checkbox named
giftwithvalue="yes". - Every control has a joined
label.
Constraints
Use one form. Do not use type="number" for the phone.
Example
<option value="s">Small</option>
Why it works
Each control fits its answer: a fixed list of sizes, a counted quantity, a keypad for phone numbers, free text, and one independent yes or no.
Hints
Hint 1
Each option has a value that is sent and text that is shown.
Hint 2
textarea has a closing tag.
Hint 3
A phone number is not a quantity.
Solution
Show one correct solution (try it yourself first)
<form>
<label for="size">Size</label>
<select id="size" name="size">
<option value="s">Small</option>
<option value="m" selected>Medium</option>
<option value="l">Large</option>
</select>
<label for="qty">Quantity</label>
<input id="qty" name="qty" type="number" min="1" value="1">
<label for="phone">Phone</label>
<input id="phone" name="phone" type="tel">
<label for="note">Note</label>
<textarea id="note" name="note" rows="3"></textarea>
<input id="gift" name="gift" type="checkbox" value="yes">
<label for="gift">Gift wrap</label>
</form>