HTML Forms (Part 2) - Revision Sheet
<form> tag encloses user input elements; controls data submission.action attribute specifies server script URL; method defines data transmission (POST or GET).%xx; spaces as + or %20.<input type="submit"> triggers form submission; <input type="reset"> clears inputs.YYYY-MM-DD, YYYY-MM-DDTHH:MM:SS, etc.<textarea> supports multi-line input; size via rows, cols; maxlength limits characters.<select> creates dropdowns with <option>; supports multiple and size.required, autofocus, formnovalidate, autocomplete, datalist.name for single selection.<form> — container for user inputs, defines submission behavior.<input> — various types for specific data (text, email, date, file, etc.).<textarea> — multi-line text input.<select> — dropdown menu with options.<option> — individual choice within <select>.<datalist> — provides input suggestions.<button> — clickable buttons; type can be submit, reset, button.name attribute — groups inputs for server-side processing.value attribute — data sent to server; default display text.<form> submits data via specified action and method.%xx; spaces as + or %20.<textarea> allows multi-line input; size controls visible area.<select> with <option> creates dropdown; selected sets default.name allow only one selection within group.<input type="file"> supports multiple files with multiple.<input type="hidden"> stores invisible data; not secure.<input type="image"> acts as a submit button with image.type="range") accept min, max, step.<datalist> enhances <input> with suggestions.| Item | Key Features | Notes / Differences |
|---|---|---|
<form> | Container for inputs; controls submission | action, method define behavior |
action | URL of server script | e.g., submit.php |
method | post (hidden), get (visible in URL) | Data transmission method |
| URL encoding | Unsafe characters replaced with %xx; spaces as + or %20 | Ensures URL validity |
<input type="submit"> | Sends form data | Initiates submission |
<input type="reset"> | Clears form inputs | Resets to initial state |
Text input (type="text") | Supports size, maxlength, placeholder | User text entry |
| Date/time inputs | Use RFC3339 format (YYYY-MM-DD, YYYY-MM-DDTHH:MM:SS) | Enforces correct date/time format |
<textarea> | Multi-line text; size via rows, cols; maxlength | Comments, descriptions |
<select> | Dropdown list; options with value; supports multiple | Multiple selection possible |
| Validation attributes | required, autofocus, formnovalidate, autocomplete, datalist | Enhance validation and UX |
Form
├─ Action & Method
│ ├─ action: server script URL
│ └─ method: post or get
├─ Data Encoding
│ └─ unsafe characters replaced with %xx
├─ Buttons
│ ├─ Submit: `<input type="submit">`
│ └─ Reset: `<input type="reset">`
├─ Input Elements
│ ├─ Text: `<input type="text">` (size, maxlength, placeholder)
│ ├─ Date/Time: date, datetime-local, time, week (RFC3339)
│ ├─ Email, URL, Tel: validation enforced
│ ├─ File: upload with `multiple`
│ ├─ Hidden: invisible data
│ ├─ Color: hex code (`#RRGGBB`)
│ ├─ Number: min, max, step
│ ├─ Password: masked input
│ ├─ Radio/Checkbox: grouped via `name`
│ ├─ Range: slider with min, max, step
│ └─ Search: search input
└─ Textarea & Select
├─ `<textarea>`: multi-line input
└─ `<select>`: dropdown with `<option>`s
name attribute on inputs; data won't be sent.GET (URL parameters) with POST (request body).<input type="reset">; can frustrate users.<input type="hidden"> provides security; it does not.value and display text in <option>; ensure value is correct.multiple attribute when multiple files or options are needed.required attribute; missing mandatory fields.<form> structure, action, and method.+ or %20.<textarea> supports multi-line input; size and maxlength.<select> with <option> for dropdowns; default selection via selected.required, autofocus, formnovalidate.name.<input type="file" multiple>.<input type="image"> submits form with image button.min, max, step.<datalist> provides suggestions for <input>.autocomplete to enhance user experience.Teste dein Wissen zu Mastering HTML Forms and Input Elements mit 10 Multiple-Choice-Fragen mit detaillierten Korrekturen.
1. What is the primary purpose of the `<form>` tag in HTML?
2. What is the primary purpose of the `<form>` tag in HTML?
Merke dir die Schlüsselkonzepte von Mastering HTML Forms and Input Elements mit 10 interaktiven Karteikarten.
HTML form — purpose?
Collects and sends user data to server
`<form>` — role?
Container for inputs, handles submission
`method` attribute — options?
POST or GET
Intelligence Artificielle
Bases de données
Bases de données
Importiere deinen Kurs und die KI erstellt in 30 Sekunden Lernzettel, Quizze und Karteikarten.
Lernzettel-Generator