9609c04755
W3Schools 튜토리얼을 P-Reinforce v3.1 포맷으로 위키화(영어 본문, 한/영 섹션 헤더). - Topic_HTML: 59문서 (튜토리얼+예제, 레퍼런스/메타 제외) - Topic_CSS: 190문서 (메인 + Advanced/Flexbox/Grid/RWD 전체) - Topic_JavaScript: 120문서 (코어 언어; Temporal/DOM상세/BOM/WebAPI/AJAX/jQuery/Graphics 등은 후속) 각 폴더 00_INDEX.md(MOC) 포함. 코드 verbatim, 미확인분은 "Not found in source" 표기. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
163 lines
6.8 KiB
Markdown
163 lines
6.8 KiB
Markdown
---
|
|
id: html-forms
|
|
title: "HTML Forms"
|
|
category: "Frontend"
|
|
status: "draft"
|
|
verification_status: "conceptual"
|
|
canonical_id: ""
|
|
aliases: ["HTML form", "form element", "input element", "web forms", "form input", "HTML form controls"]
|
|
duplicate_of: ""
|
|
source_trust_level: "B"
|
|
confidence_score: 0.90
|
|
created_at: 2026-06-23
|
|
updated_at: 2026-06-23
|
|
review_reason: ""
|
|
merge_history: []
|
|
tags: ["html", "web", "frontend", "forms", "input", "w3schools"]
|
|
raw_sources: ["https://www.w3schools.com/html/html_forms.asp"]
|
|
applied_in: []
|
|
github_commit: ""
|
|
---
|
|
|
|
# [[HTML Forms]]
|
|
|
|
## 🎯 한 줄 통찰 (One-line insight)
|
|
The HTML `<form>` element is a container for collecting user input, holding controls like text fields, radio buttons, checkboxes, and submit buttons — most of which are variations of the all-purpose `<input>` element. [S1]
|
|
|
|
## 🧠 핵심 개념 (Core concepts)
|
|
- **`<form>` as container** — wraps the input controls used to collect user input. [S1]
|
|
- **`<input>` is the workhorse** — the most-used form element; its appearance and behavior change with the `type` attribute (text, radio, checkbox, submit, button). [S1]
|
|
- **`<label>` for accessibility** — labels identify controls and benefit screen-reader users; bind a label to a control by matching the label's `for` to the input's `id`. [S1]
|
|
- **The `name` attribute is required for submission** — each input must have a `name`; if omitted, that field's value is not sent at all. [S1]
|
|
|
|
## 🧩 추출된 패턴 (Extracted patterns)
|
|
- **Form container pattern** — `<form>` … form elements … `</form>`. [S1]
|
|
- **Labeled text field** — `<label for="x">…</label>` + `<input type="text" id="x" name="x">`. [S1]
|
|
- **Radio group** — multiple `<input type="radio">` sharing the same `name` (select one). [S1]
|
|
- **Submit pattern** — `<input type="submit" value="Submit">` inside a `<form action="...">`. [S1]
|
|
|
|
## 📖 세부 내용 (Details)
|
|
**The `<form>` Element**
|
|
The HTML `<form>` element is used to create an HTML form for user input. It is a container for different types of input elements such as text fields, checkboxes, radio buttons, and submit buttons. [S1]
|
|
```html
|
|
<form>
|
|
.
|
|
form elements
|
|
.
|
|
</form>
|
|
```
|
|
|
|
**The `<input>` Element**
|
|
The HTML `<input>` element is the most used form element. It can be displayed in many ways, depending on the `type` attribute. [S1]
|
|
|
|
| Type | Description |
|
|
|---|---|
|
|
| `<input type="text">` | Displays a single-line text input field |
|
|
| `<input type="radio">` | Displays a radio button (for selecting one of many choices) |
|
|
| `<input type="checkbox">` | Displays a checkbox (for selecting zero or more of many choices) |
|
|
| `<input type="submit">` | Displays a submit button (for submitting the form) |
|
|
| `<input type="button">` | Displays a clickable button |
|
|
|
|
**Text Fields**
|
|
`<input type="text">` defines a single-line input field for text. The default width of an input field is 20 characters. [S1]
|
|
```html
|
|
<form>
|
|
<label for="fname">First name:</label><br>
|
|
<input type="text" id="fname" name="fname"><br>
|
|
<label for="lname">Last name:</label><br>
|
|
<input type="text" id="lname" name="lname">
|
|
</form>
|
|
```
|
|
|
|
**The `<label>` Element**
|
|
The `<label>` tag defines a label for several form elements and is useful for screen-reader users. The `for` attribute of the `<label>` tag should be equal to the `id` attribute of the `<input>` element to bind them together. [S1]
|
|
|
|
**Radio Buttons**
|
|
A radio button lets a user select ONE of a limited number of choices. [S1]
|
|
```html
|
|
<p>Choose your favorite Web language:</p>
|
|
|
|
<form>
|
|
<input type="radio" id="html" name="fav_language" value="HTML">
|
|
<label for="html">HTML</label><br>
|
|
<input type="radio" id="css" name="fav_language" value="CSS">
|
|
<label for="css">CSS</label><br>
|
|
<input type="radio" id="javascript" name="fav_language" value="JavaScript">
|
|
<label for="javascript">JavaScript</label>
|
|
</form>
|
|
```
|
|
|
|
**Checkboxes**
|
|
Checkboxes let a user select ZERO or MORE options of a limited number of choices. [S1]
|
|
```html
|
|
<form>
|
|
<input type="checkbox" id="vehicle1" name="vehicle1" value="Bike">
|
|
<label for="vehicle1"> I have a bike</label><br>
|
|
<input type="checkbox" id="vehicle2" name="vehicle2" value="Car">
|
|
<label for="vehicle2"> I have a car</label><br>
|
|
<input type="checkbox" id="vehicle3" name="vehicle3" value="Boat">
|
|
<label for="vehicle3"> I have a boat</label>
|
|
</form>
|
|
```
|
|
|
|
**The Submit Button**
|
|
`<input type="submit">` defines a button for submitting the form data to a form-handler (specified by the form's `action` attribute). [S1]
|
|
```html
|
|
<form action="/action_page.php">
|
|
<label for="fname">First name:</label><br>
|
|
<input type="text" id="fname" name="fname" value="John"><br>
|
|
<label for="lname">Last name:</label><br>
|
|
<input type="text" id="lname" name="lname" value="Doe"><br><br>
|
|
<input type="submit" value="Submit">
|
|
</form>
|
|
```
|
|
|
|
**The Name Attribute for `<input>`**
|
|
Each input field must have a `name` attribute to be submitted. If the `name` attribute is omitted, the value of the input field will not be sent at all. Example where `name` is omitted (the value will not be sent): [S1]
|
|
```html
|
|
<form action="/action_page.php">
|
|
<label for="fname">First name:</label><br>
|
|
<input type="text" id="fname" value="John"><br><br>
|
|
<input type="submit" value="Submit">
|
|
</form>
|
|
```
|
|
|
|
## 🛠️ 적용 사례 (Applied in summary)
|
|
The submit-button example above is the canonical applied case: a complete form posting first/last name to `/action_page.php`. No external project/commit applications found in the source.
|
|
|
|
## 💻 코드 패턴 (Code patterns)
|
|
Minimal submitting form (HTML):
|
|
```html
|
|
<form action="/action_page.php">
|
|
<label for="fname">First name:</label><br>
|
|
<input type="text" id="fname" name="fname"><br>
|
|
<input type="submit" value="Submit">
|
|
</form>
|
|
```
|
|
Radio group (one choice, shared name):
|
|
```html
|
|
<input type="radio" id="html" name="fav_language" value="HTML">
|
|
<label for="html">HTML</label>
|
|
```
|
|
|
|
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
|
|
No contradictions found in the source. [S1]
|
|
|
|
## ✅ 검증 상태 및 신뢰도
|
|
- **상태:** draft
|
|
- **검증 단계:** conceptual (실제 적용 사례 발견 시 applied/validated로 승격 가능)
|
|
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
|
|
- **신뢰 점수:** 0.90
|
|
- **중복 검사 결과:** 신규 생성 (New discovery)
|
|
|
|
## 🔗 지식 그래프 (Knowledge Graph)
|
|
- **상위/루트:** [[HTML Tutorial]]
|
|
- **관련 개념:** [[HTML Form Attributes]], [[HTML Form Elements]], [[HTML Input Types]], [[HTML Links]]
|
|
- **참조 맥락:** The foundation referenced whenever collecting user input on a web page.
|
|
|
|
## 📚 출처 (Sources)
|
|
- [S1] W3Schools — HTML Forms — https://www.w3schools.com/html/html_forms.asp
|
|
|
|
## 📝 변경 이력 (Change history)
|
|
- 2026-06-23: Initial draft synthesized from the W3Schools "HTML Forms" page (Astra wiki-curation, P-Reinforce v3.1 format).
|