select submits a chosen option value; textarea submits its text content under a name.
HTML select and textarea: preserve meaningful values and editable text
Use it for a real task
A review form makes the initial reason choice intentionally empty, then asks for free-text context. The first option is disabled and selected so the required select cannot quietly send a business decision. The textarea has a visible label and a character limit; server validation still owns the stored record.
<form action="/receipts/review" method="post">
<label for="review-reason">Reason</label>
<select id="review-reason" name="reason" required>
<option value="" selected disabled>Choose a reason</option>
<option value="amount-mismatch">Amount mismatch</option>
<option value="missing-approval">Missing approval</option>
</select>
<label for="review-context">Context</label>
<textarea id="review-context" name="context" maxlength="240"></textarea>
<button type="submit">Save review</button>
</form>What the markup guarantees
Option text is for readers; value is the API input. Keep codes stable when copy changes. A disabled placeholder option does not absolve the server from rejecting an empty or unknown reason.
Cost and limits
The controls cost little until option lists become long. Large remote vocabularies may need search, but replacing select with a custom widget adds keyboard and focus obligations.
Common Mistakes
- Do not make a placeholder a valid business value.
- Do not rely on displayed option text as the stable submitted code.
- Textarea content is text, not trusted HTML.
Connected lessons
- HTML radio and checkbox controls: submit choices with explicit values
- HTML constraint validation: improve feedback without trusting the browser
- HTML labels: bind each control to a durable accessible name
Related: HTML radio and checkbox controls: submit choices with explicit values.
Continue with HTML datalist: offer suggestions without closing the input.
Related: HTML reset button: restore initial form values, not a saved record.
Related: HTML optgroup and multiple select: make several choices explicit.
Related: HTML required select: use an empty first choice when no decision exists.
Related: HTML textarea wrap: distinguish display wrapping from submitted line breaks.
