-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClass_Day4.html
More file actions
365 lines (243 loc) · 11.5 KB
/
Copy pathClass_Day4.html
File metadata and controls
365 lines (243 loc) · 11.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML Class Day-4 (Forms)</title>
</head>
<body>
<h1>HTML Forms</h1>
<p>HTML forms, defined using the <strong><u>form</u></strong> tag, are essential for collecting user input on web pages. <br>They include interactive controls like text fields, emails, passwords, checkboxes, radios, and buttons.</p>
<h3>Basic HTML Form</h3>
<form>
<label for="UserName">UserName</label> <br>
<input type="text" id="username" name="username"> <br><br>
<label>Password</label> <br>
<input type="password" id="password" name="password"> <br><br>
<input type="submit" value="Submit">
</form>
<hr>
<h3>Form outside, Fieldset inside {Correct Way}</h3>
<p>The <u>fieldset</u> is used only for grouping related inputs visually and semantically.<br>
When you submit the form, all inputs inside the fieldset are included in the form submission.</p>
<form>
<fieldset>
<legend>Personal Info</legend>
<label>Name:</label>
<input type="text"> <br><br>
<label>Email:</label>
<input type="email">
</fieldset>
</form>
<hr>
<h3>fieldset outside, form inside {unusual}</h3>
<p>
<ul>
<li>The <strong><u>Fieldset</u></strong> doesn’t actually control form submission — it only groups elements visually.</li>
<li>If you put multiple <strong><u>Form</u></strong> tags inside one <strong><u>Fieldset</u></strong>, each form submits separately.</li>
<li>This structure is valid HTML but not practical, because fieldsets are meant to group inputs within a single form, not wrap multiple forms.</li>
</ul>
</p>
<fieldset>
<legend>Personal Info</legend>
<form>
<label>Name:</label>
<input type="text"> <br><br>
<label>Email:</label>
<input type="email">
</form>
</fieldset>
<hr>
<h3>Advanced HTML Form</h3>
<form action="#" method="post">
<!-- we will use method="post" for more security if we don't give any it will take "get" automatically-->
<label for="name">Enter Your Full Name: </label>
<input type="name" id="name" name="name" required placeholder="Enter Your Name">
<br><br>
<label for="email">Email Address: </label>
<input type="email" id="email" name="name" required placeholder="email">
<br><br>
<label for="password">Password: </label>
<input type="password" id="password" name="pass" required placeholder="Password">
<br><br>
<label for="confirmpassword">Confirm Password: </label>
<input type="password" id="confirmpassword" name="confirmpass" required placeholder="Confirm Password">
<br><br>
<label for="gender">Gender: </label>
<input type="radio" id="gender" name="gender" value="male">Male
<input type="radio" id="gender" name="gender" value="female">Female>
<input type="radio" id="gender" name="gender" value="others">Others
<br><br>
<label for="dob">Date Of Birth: </label>
<input type="datetime-local" id="dob" name="dob" required>
<br><br>
<label for="phno">Phone Number: </label>
<input type="tel" id="phno" name="phno" value="+91" required>
<br><br>
<label for="age">Age: </label>
<input type="number" id="age" name="age" required>
<br><br>
<label for="address">Address: </label> <br>
<textarea id="address" name="address" ></textarea>
<br><br>
<label for="place">Place: </label>
<select id="place" name="place" >
<optgroup label="Karnataka">
<option value=""></option>
<option value="">BTM Layout</option>
<option value="">HSR Layout</option>
<option value="">Tin Factory</option>
<option value="">Majestic</option>
<option value="">Maratahalli</option>
</optgroup>
<optgroup label="Hyderabad">
<option value="">Charminar</option>
<option value="">Golconda</option>
<option value="">Tank Bund</option>
<option value="">Hitech City</option>
<option value="">Begampet</option>
</optgroup>
</select>
<br><br>
<label for="course">Course: </label>
<input type="checkbox" id="course" name="course" value="java">Java
<input type="checkbox" id="course" name="course" value="python">Python
<input type="checkbox" id="course" name="course" value="my sql">My Sql
<input type="checkbox" id="course" name="course" value="c++">C++
<br><br>
<!-- For All Different Types Of Files -->
<label for="file">File: </label>
<input type="file" id="file" name="file">
<br><br>
<!-- Image file -->
<label for="imagefile">Image File: </label>
<input type="file" id="imagefile" name="imagefile" accept="image/*">
<br><br>
<!-- Audio file -->
<label for="audiofile">Audio File: </label>
<input type="file" id="audiofile" name="audiofile" accept="audio/*">
<br><br>
<!-- Video file -->
<label for="videofile">Video File: </label>
<input type="file" id="videofile" name="videofile" accept="video/*">
<br><br>
<!-- PDF file -->
<label for="pdffile">PDF File: </label>
<input type="file" id="pdffile" name="pdffile" accept="application/pdf">
<br><br>
<!-- Word Document -->
<label for="docfile">Word Document: </label>
<input type="file" id="docfile" name="docfile" accept=".doc,.docx">
<br><br>
<!-- Excel File -->
<label for="excelfile">Excel File: </label>
<input type="file" id="excelfile" name="excelfile" accept=".xls,.xlsx">
<br><br>
<!-- Text File -->
<label for="textfile">Text File: </label>
<input type="file" id="textfile" name="textfile" accept=".txt">
<br><br>
<button type="submit">Submit</button>
<input type="reset" value="reset">
</form>
<hr>
<h1>Applying Elements to Form</h1>
<h3>Fieldset</h3>
<p><strong><u>Fieldset</u></strong> is used to draw a box around other form elements and group the related data.</p>
<h3>Legend</h3>
<p><strong><u>legend</u></strong> defines a caption for fieldset elements</p>
<form action="#" method="post" align="center">
<fieldset>
<legend>User Personal Information</legend>
<label for="name">Enter Your Full Name: </label>
<input type="name" id="name" name="name" required placeholder="Enter Your Name">
<br><br>
<label for="email">Email Address: </label>
<input type="email" id="email" name="name" required placeholder="email">
<br><br>
<label for="password">Password: </label>
<input type="password" id="password" name="pass" required placeholder="Password">
<br><br>
<label for="confirmpassword">Confirm Password: </label>
<input type="password" id="confirmpassword" name="confirmpass" required placeholder="Confirm Password">
<br><br>
<label for="gender">Gender: </label>
<input type="radio" id="gender" name="gender" value="male">Male
<input type="radio" id="gender" name="gender" value="female">Female>
<input type="radio" id="gender" name="gender" value="others">Others
<br><br>
<label for="dob">Date Of Birth: </label>
<input type="datetime-local" id="dob" name="dob" required>
<br><br>
<label for="phno">Phone Number: </label>
<input type="tel" id="phno" name="phno" value="+91" required>
<br><br>
<label for="age">Age: </label>
<input type="number" id="age" name="age" required>
<br><br>
<label for="address">Address: </label> <br>
<textarea id="address" name="address" ></textarea>
<br><br>
<label for="place">Place: </label>
<select id="place" name="place" >
<optgroup label="Karnataka">
<option value=""></option>
<option value="">BTM Layout</option>
<option value="">HSR Layout</option>
<option value="">Tin Factory</option>
<option value="">Majestic</option>
<option value="">Maratahalli</option>
</optgroup>
<optgroup label="Hyderabad">
<option value="">Charminar</option>
<option value="">Golconda</option>
<option value="">Tank Bund</option>
<option value="">Hitech City</option>
<option value="">Begampet</option>
</optgroup>
</select>
<br><br>
<label for="course">Course: </label>
<input type="checkbox" id="course" name="course" value="java">Java
<input type="checkbox" id="course" name="course" value="python">Python
<input type="checkbox" id="course" name="course" value="my sql">My Sql
<input type="checkbox" id="course" name="course" value="c++">C++
<br><br>
<!-- For All Different Types Of Files -->
<label for="file">File: </label>
<input type="file" id="file" name="file">
<br><br>
<!-- Image file -->
<label for="imagefile">Image File: </label>
<input type="file" id="imagefile" name="imagefile" accept="image/*">
<br><br>
<!-- Audio file -->
<label for="audiofile">Audio File: </label>
<input type="file" id="audiofile" name="audiofile" accept="audio/*">
<br><br>
<!-- Video file -->
<label for="videofile">Video File: </label>
<input type="file" id="videofile" name="videofile" accept="video/*">
<br><br>
<!-- PDF file -->
<label for="pdffile">PDF File: </label>
<input type="file" id="pdffile" name="pdffile" accept="application/pdf">
<br><br>
<!-- Word Document -->
<label for="docfile">Word Document: </label>
<input type="file" id="docfile" name="docfile" accept=".doc,.docx">
<br><br>
<!-- Excel File -->
<label for="excelfile">Excel File: </label>
<input type="file" id="excelfile" name="excelfile" accept=".xls,.xlsx">
<br><br>
<!-- Text File -->
<label for="textfile">Text File: </label>
<input type="file" id="textfile" name="textfile" accept=".txt">
<br><br>
<button type="submit">Submit</button>
<input type="reset" value="reset">
</fieldset>
</form>
</body>
</html>