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.Metti alla prova le tue conoscenze su Mastering HTML Forms and Input Elements con 10 domande a scelta multipla con correzioni dettagliate.
1. What is the primary purpose of the `<form>` tag in HTML?
2. What is the primary purpose of the `<form>` tag in HTML?
Memorizza i concetti chiave di Mastering HTML Forms and Input Elements con 10 flashcard interattive.
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
Bases de donnΓ©es
Importa il tuo corso e l'AI genera schede, quiz e flashcard in 30 secondi.
Generatore di schede