Lab 06: Lists, Tables & Navigation

🎯 Objective

Build functional HTML forms using <form>, <input>, <textarea>, <select>, <button>, and various input types with proper labels and validation.

📚 Background

Forms are how users interact with web applications. HTML5 introduced many new input types (email, date, range, color, etc.) that provide built-in validation and mobile-friendly keyboards. Every form control needs a properly associated <label>.

⏱️ Estimated Time

35 minutes

📋 Prerequisites

  • Labs 1–5 completed

🛠️ Tools Used

  • Python 3, Web browser

🔬 Lab Instructions

Step 1: Create the lab file

Step 2: Create a registration form skeleton

Step 3: Add text input types

💡 autocomplete attributes help password managers and mobile keyboards.

Step 4: Add selection controls

Step 5: Add range, color, and file inputs

Step 6: Add submit and reset buttons

Step 7: Validate the HTML

📸 Verified Output:

Step 8: Test browser validation

Open http://localhost:8080/lab06-forms.html. Try to submit the form without filling required fields.

📸 Verified Output:

  • Empty required fields show a browser validation tooltip

  • Invalid email format is caught automatically

  • The range slider updates the displayed number in real time

✅ Verification

🚨 Common Mistakes

  • Missing <label> — Every input must have a label associated via for/id

  • <label> without for — Must match the input's id attribute

  • Using GET for sensitive data — Passwords/credit cards should use POST

  • No required on mandatory fields — Add HTML5 validation

  • No autocomplete — Helps users and accessibility tools

📝 Summary

You built a complete form with:

  • Text, email, password, tel, date, number, URL inputs

  • <select> with <optgroup> and multiple

  • Radio buttons and checkboxes

  • Range, color, and file inputs

  • <textarea> for multi-line text

  • <fieldset> and <legend> for grouping

  • <button type="submit"> and <button type="reset">

🔗 Further Reading

Last updated