File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Task 20 - Form Validation
2+
3+ ## ✅ Objective:
4+ Build a form that validates user inputs (Name, Email, Password) in real-time before submission.
5+
6+ ## 💡 Concepts Practiced:
7+ - DOM manipulation for error and success messages
8+ - Event handling with ` addEventListener("submit") `
9+ - Regular expressions (Regex) for email validation
10+ - Preventing default form submission with ` preventDefault() `
11+ - Responsive form design using CSS media queries
12+
13+ ## 📘 What I Learned:
14+ - How to validate inputs dynamically and show user-friendly error messages.
15+ - How to apply regex to check for valid email formats.
16+ - How to use ` form.reset() ` after successful submission.
17+ - How to structure forms with reusable validation logic.
18+ - How to design responsive forms for mobile, tablet, and desktop.
19+
20+ ## ▶️ Example Flow:
21+ 1 . User leaves Name empty → shows ` "Name is required" ` in red.
22+ 2 . User enters invalid Email → shows ` "Enter a valid email" ` .
23+ 3 . User enters Password shorter than 6 characters → shows ` "Password must be at least 6 characters" ` .
24+ 4 . Once all fields are valid → form resets and ` "Form submitted successfully!" ` is displayed in green.
You can’t perform that action at this time.
0 commit comments