Forms and User Input
Why Forms Matter
Forms as a bridge
Forms let users send information to a website, such as contact details, search terms, checkout information, or feedback.
Accessibility and clarity
Every form field should have a clear label. Helpful placeholder text is fine, but it should not replace labels.
Common form elements
| Element | Purpose |
|---|---|
form | Wraps input controls |
label | Describes a field |
input | Accepts user text or other data |
textarea | Multi-line text entry |
button | Submits or triggers an action |
Do not hide important instructions
If users need a format such as a date, password rule, or phone number, make the requirement visible before submission.
What is the main purpose of a form?
Forms are designed to gather information from users.
Correct answer: Collecting user input
Why are labels important in forms?
Labels improve usability and accessibility.
Correct answer: They tell users what each input field is for.
Which element is best for writing a longer message?
textarea is made for multi-line text.
Correct answer: textarea
Validation
Validation checks whether input is complete or correctly formatted. Some validation can happen in the browser, and some can happen on the server.