MODULE 2 β Forms & User Input
π Lesson 2.6 β Building a Registration Form
π Creating a Complete Student Registration Form Using HTML
π― Learning Objectives
After completing this lesson, students will be able to:
β Create a complete registration form
β Use different input types
β Use radio buttons
β Use checkboxes
β Use dropdown menus
β Use text areas
β Apply form validation
β Build professional forms
π Introduction
Until now we have learned:
β Input Fields
β Email Fields
β Password Fields
β Radio Buttons
β Checkboxes
β Dropdown Menus
β Text Areas
β Validation
Now it’s time to combine everything and create a:
π« Student Registration Form
This type of form is commonly used in:
- Schools
- Colleges
- Universities
- Training Institutes
- Online Courses
π What Information Should a Registration Form Collect?
A registration form usually collects:
Personal Information
- Name
- Mobile Number
- Date of Birth
Educational Information
- Branch
- Semester
Other Information
- Gender
- Skills
- Address
ποΈ Registration Form Structure
----------------------------------
Student Registration Form
----------------------------------
Name
Email
Password
Mobile Number
Date of Birth
Gender
Branch
Skills
Address
Submit Button
Reset Button
----------------------------------
π― Step 1 β Create HTML Structure
<!DOCTYPE html>
<html>
<head>
<title>Student Registration Form</title>
</head>
<body>
<h1>Student Registration Form</h1>
</body>
</html>
π― Step 2 β Create Form Tag
<form>
</form>
Complete Structure
<h1>Student Registration Form</h1>
<form>
</form>
π― Step 3 β Add Name Field
<label>Student Name:</label>
<br>
<input
type="text"
placeholder="Enter Your Name"
required>
<br><br>
Output
Student Name
[Enter Your Name]
π― Step 4 β Add Email Field
<label>Email:</label>
<br>
<input
type="email"
placeholder="Enter Email"
required>
<br><br>
π― Step 5 β Add Password Field
<label>Password:</label>
<br>
<input
type="password"
placeholder="Enter Password"
required>
<br><br>
π― Step 6 β Add Mobile Number
<label>Mobile Number:</label>
<br>
<input
type="tel"
pattern="[0-9]{10}"
placeholder="9876543210"
required>
<br><br>
π― Step 7 β Add Date of Birth
<label>Date of Birth:</label>
<br>
<input
type="date">
<br><br>
π― Step 8 β Add Gender Selection
<label>Gender:</label>
<br>
<input
type="radio"
name="gender">
Male
<br>
<input
type="radio"
name="gender">
Female
<br>
<input
type="radio"
name="gender">
Other
<br><br>
Output
β Male
β Female
β Other
Only one can be selected.
π― Step 9 β Add Branch Dropdown
<label>Branch:</label>
<br>
<select>
<option>
Computer Science
</option>
<option>
Mechanical
</option>
<option>
Civil
</option>
<option>
Electrical
</option>
<option>
Electronics
</option>
</select>
<br><br>
Output
Dropdown menu appears.
π― Step 10 β Add Skills Section
<label>Skills:</label>
<br>
<input
type="checkbox">
HTML
<br>
<input
type="checkbox">
CSS
<br>
<input
type="checkbox">
JavaScript
<br>
<input
type="checkbox">
Python
<br><br>
Output
β HTML
β CSS
β JavaScript
β Python
Multiple skills can be selected.
π― Step 11 β Add Address Field
<label>Address:</label>
<br>
<textarea
rows="5"
cols="30"
placeholder="Enter Address">
</textarea>
<br><br>
π― Step 12 β Add Submit Button
<input
type="submit"
value="Register">
Output
[ Register ]
π― Step 13 β Add Reset Button
<input
type="reset"
value="Clear Form">
Output
[ Clear Form ]
Clears all entered data.
π» Complete Registration Form Program
<!DOCTYPE html>
<html>
<head>
<title>Student Registration Form</title>
</head>
<body>
<h1>Student Registration Form</h1>
<form>
<label>Student Name:</label>
<br>
<input
type="text"
placeholder="Enter Your Name"
required>
<br><br>
<label>Email:</label>
<br>
<input
type="email"
placeholder="Enter Email"
required>
<br><br>
<label>Password:</label>
<br>
<input
type="password"
placeholder="Enter Password"
required>
<br><br>
<label>Mobile Number:</label>
<br>
<input
type="tel"
pattern="[0-9]{10}"
placeholder="9876543210"
required>
<br><br>
<label>Date of Birth:</label>
<br>
<input
type="date">
<br><br>
<label>Gender:</label>
<br>
<input
type="radio"
name="gender"> Male
<br>
<input
type="radio"
name="gender"> Female
<br>
<input
type="radio"
name="gender"> Other
<br><br>
<label>Branch:</label>
<br>
<select>
<option>Computer Science</option>
<option>Mechanical</option>
<option>Civil</option>
<option>Electrical</option>
<option>Electronics</option>
</select>
<br><br>
<label>Skills:</label>
<br>
<input type="checkbox"> HTML
<br>
<input type="checkbox"> CSS
<br>
<input type="checkbox"> JavaScript
<br>
<input type="checkbox"> Python
<br><br>
<label>Address:</label>
<br>
<textarea
rows="5"
cols="30"
placeholder="Enter Address">
</textarea>
<br><br>
<input
type="submit"
value="Register">
<input
type="reset"
value="Clear Form">
</form>
</body>
</html>
π― Expected Output
Student Registration Form containing:
β Name
β Email
β Password
β Mobile Number
β Date of Birth
β Gender
β Branch
β Skills
β Address
β Register Button
β Clear Form Button
π Real World Example
This form structure is used in:
College Admission Form
Student Registration Form
Course Enrollment Form
Training Registration Form
Internship Registration Form
β οΈ Common Beginner Mistakes
Mistake 1
Different Names for Radio Buttons
Wrong:
<input type="radio" name="a">
<input type="radio" name="b">
Correct:
<input type="radio" name="gender">
<input type="radio" name="gender">
Mistake 2
Using Text Instead of Email
Wrong:
<input type="text">
Correct:
<input type="email">
Mistake 3
Forgetting Required Fields
Wrong:
<input type="text">
Better:
<input type="text" required>
π Best Practices
β Use proper labels.
β Use placeholders.
β Validate important fields.
β Keep form organized.
β Use correct input types.
β Use dropdowns for fixed options.
π Mini Project β Institute Registration Form
Create a form containing:
β Student Name
β Father’s Name
β Email
β Mobile Number
β Branch
β Gender
β Skills
β Address
β Submit Button
π Practical Activity
Create your own:
Polytechnic Student Registration Form
Include:
- Name
- Mobile
- DOB
- Branch
- Skills
- Address
Run in Chrome Browser.
Take a Screenshot.
π Assignment
Assignment 2.6
- What is a Registration Form?
- Which input type is used for passwords?
- Why is the
requiredattribute important? - Which tag creates a dropdown menu?
- Which tag creates a textarea?
- Create a complete registration form.
- Add validation to Name and Email fields.
π§ Quiz
Q1. Which input type hides characters?
A. text
B. password
C. email
D. date
β Answer: B
Q2. Which tag creates a dropdown menu?
A. option
B. menu
C. select
D. list
β Answer: C
Q3. Which tag creates a text area?
A. input
B. area
C. textarea
D. text
β Answer: C
Q4. Which button submits a form?
A. reset
B. clear
C. submit
D. send
β Answer: C
Q5. Which button clears a form?
A. delete
B. reset
C. submit
D. remove
β Answer: B
π Lesson Summary
β Registration forms collect user information.
β Forms combine multiple HTML form elements.
β Input fields, radio buttons, checkboxes, dropdowns, and textareas work together.
β Validation ensures accurate data entry.
β Registration forms are widely used in real-world applications.