-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFORM VALIDATION.html
More file actions
135 lines (130 loc) · 4.22 KB
/
FORM VALIDATION.html
File metadata and controls
135 lines (130 loc) · 4.22 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
<!--1/6: Introduction to HTML Form Validation
2/6: Requiring an Input-->
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Number Guessing</title>
<link rel="stylesheet" href="style.css" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Spicy+Rice" rel="stylesheet">
</head>
<body>
<section class="overlay">
<h1>Guess the right number!</h1>
<form action="check.html" method="GET">
<!--Add a required attribute to the input element-->
<input type="number" name="guess" id="guess" required>
<label for="guess">Enter a number between 1-10:</label>
<br>
<input type="submit" id="submission" value="Submit">
</form>
</section>
</body>
</html>
<!--3/6: Set a Minimum and Maximum-->
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Number Guessing</title>
<link rel="stylesheet" href="style.css" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Spicy+Rice" rel="stylesheet">
</head>
<body>
<section class="overlay">
<h1>Guess the right number!</h1>
<form action="check.html" method="GET">
<label for="guess">Enter a number between 1-10:</label>
<br>
<!--Add the min and max attribute to the input-->
<input type="number" name="guess" id="guess" min="1" max="10" required>
<br>
<input type="submit" id="submission" value="Submit">
</form>
</section>
</body>
</html>
<!--4/6: Checking Text Length-->
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Sign Up Page</title>
<link rel="stylesheet" href="style.css" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Fjalla+One" rel="stylesheet">
</head>
<body>
<section class="overlay">
<h1>Sign Up</h1>
<p>Create an account:</p>
<form action="submission.html" method="GET">
<!--Add the minlength and maxlength attributes to the input fields-->
<label for="username">Username:</label>
<br>
<input id="username" name="username" type="text" minlength="3" maxlength="15" required>
<br>
<label for="pw">Password:</label>
<br>
<input id="pw" name="pw" type="password" minlength="8" maxlength="15" required>
<br>
<input type="submit" value="Submit">
</form>
</section>
</body>
</html>
<!--5/6: Matching a Pattern-->
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Sign Up Page</title>
<link rel="stylesheet" href="style.css" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Fjalla+One" rel="stylesheet">
</head>
<body>
<section class="overlay">
<h1>Sign Up</h1>
<p>Create an account:</p>
<form action="submission.html" method="GET">
<label for="username">Username:</label>
<br>
<!--Add the pattern attribute to the input below-->
<input id="username" name="username" type="text" required minlength="3" maxlength="15" pattern="[a-zA-Z0-9]+">
<br>
<label for="pw">Password:</label>
<br>
<input id="pw" name="pw" type="password" required minlength="8" maxlength="15">
<br>
<input type="submit" value="Submit">
</form>
</section>
</body>
</html>
<!--6/6: Review-->
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Sign Up Page</title>
<link rel="stylesheet" href="style.css" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Fjalla+One" rel="stylesheet">
</head>
<body>
<section class="overlay">
<h1>Sign Up</h1>
<p>Create an account:</p>
<form action="submission.html" method="GET">
<label for="username">Username:</label>
<br>
<input id="username" name="username" type="text" required minlength="3" maxlength="15">
<br>
<label for="pw">Password:</label>
<br>
<!--Add the pattern attribute to the input below-->
<input id="pw" name="pw" type="password" required minlength="8" maxlength="15">
<br>
<input type="submit" value="Submit">
</form>
</section>
</body>
</html>