What is the purpose of an HTML <form>?
A <form> groups related controls for collecting and submitting information.
Study 7 Forms and User Input with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.
What is the purpose of an HTML <form>?
A <form> groups related controls for collecting and submitting information.
How do you explicitly associate a label with a form control?
Give each control a visible label and connect them with matching for and id values.
How should related radio buttons be grouped accessibly?
Use <fieldset> to group related controls and <legend> to describe the group.
What does a control's name attribute do?
The name attribute identifies a control's value in submitted form data; controls without a name are generally omitted.
How can input type and autocomplete improve a form?
An appropriate type, such as email, and useful autocomplete values help browsers and users enter data.
What does a form's action attribute specify?
The action attribute specifies where the browser sends the form.
How does GET send form values, and what is it suitable for?
GET places form values in the URL and suits requests such as searches.
How does POST send form values, and when is it commonly used?
POST sends form values in the request body and is commonly used when submitting or changing data.
How should native validation requirements be communicated?
Use visible instructions alongside native constraints such as required, email, minlength, maxlength, min, and max.
Why are client-side checks not a security boundary?
Client-side checks improve usability but are not a security boundary; users can alter page code or bypass the page.
What validation must happen on the server?
Validate submitted data on the server too, and handle invalid or unexpected values safely.
Why handle a form's submit event instead of only a button click?
Listen for the form's submit event so keyboard-based submission is handled, not just button clicks.