1. What is an HTML Form? |
|
š Notes: The fundamental truth is that a website isn't just a brochure for you to read. For the web to be useful, it needs a way toĀ **collect informationĀ *from*Ā the user**Ā and send it back to the server.
|
|
![]() |
š„ Watch: |
2. input Tag |
|
š Notes: This is the most common form tag. It's a self-closing tag that creates an input field. Its behavior changes based on itsĀ typeĀ attribute.
|
|
![]() |
š„ Watch: |
3. label Tag |
|
š Notes: **The Problem:**Ā We have a box, but the user has no idea what they are supposed to type into it. Is it for a name? An email? A search query? The box is meaningless without a description. |
|
![]() |
š„ Watch: |
4. Name & Value Attributes |
|
š Notes: **The Problem:**Ā When the form is submitted, the browser needs to package the data to send to a server. How does it label the data? If a user types "Arjun" in the first box, how does the server know that "Arjun" is theĀ firstName? TheĀ idĀ attribute is only for useĀ *within*Ā the page; it is not sent to the server.
|
|
![]() |
š„ Watch: |
5. Radio Buttons |
|
š Notes: **The Problem:**Ā What if you want to ask a question where the user can only chooseĀ **one option**Ā from a predefined list? For example, "What is your gender?" or "What is your T-shirt size (Small, Medium, Large)?" A text box is a bad solutionāusers could type anything ("Med", "M", "medium"), making the data inconsistent.
|
|
![]() |
š„ Watch: |
6. checkboxes |
|
š Notes: **The Problem:**Ā Now, what if you want to ask a question where the user can chooseĀ **multiple options**? For example, "Which toppings would you like on your pizza?" A radio button won't work, because you can only select one.
|
|
![]() |
š„ Watch: |
7. Mini Project |
|
![]() |
š„ Watch: |
8. button Tag |
|
š Notes: **The Problem:**Ā OurĀ Ā works, but it's very limited. You can only put plain text in it using theĀ valueĀ attribute. What if you want a button with an image, or with bold text?
|
|
![]() |
š„ Watch: |
9. textarea Tag |
|
š Notes: **The Problem:**Ā OurĀ input type="text"Ā is great for single lines of text like a name, but it's terrible for longer input, like a user comment or a shipping address. The text just scrolls sideways and becomes unreadable.
|
|
![]() |
š„ Watch: |
10. Homework |
|
![]() |
š„ Watch: |