-
Notifications
You must be signed in to change notification settings - Fork 0
/
sign-up.html
164 lines (141 loc) · 5.56 KB
/
sign-up.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link
href="https://fonts.googleapis.com/css2?family=Comfortaa:wght@300;400;500;600;700&family=Gloock&family=Paytone+One&family=Roboto:wght@100;300;400;500;700&family=Unna:ital,wght@0,400;0,700;1,400&family=Young+Serif&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="indexstyle.css">
<script src="https://kit.fontawesome.com/b284ece004.js" crossorigin="anonymous"></script>
<title>Sign Up</title>
<style>
button {
background-color: #512D7A;
color: #EAD1DC;
padding: 10px 20px;
border: none;
cursor: pointer;
}
</style>
</head>
<body>
<!--SIDE BAR starts-->
<div id="sidebar">
<form action="purchase.html">
<input type="submit" value="Go to Purchase" />
</form>
<form action="search.html">
<input type="submit" value="Find Mushrooms" />
</form>
<form action="Gallery.html">
<input type="submit" value="Picture gallery" />
</form>
<form action="map_new.html">
<input type="submit" value="Mushroom maps" />
</form>
</div>
<!--SIDE BAR ends-->
<!-- Header starts -->
<header>
<div class="logorow column" style="flex-grow: 1;"><a class="logorow column" style="flex-grow: 1;"
href="index.html"><img src="images/mushroom-logo.png">`
<h1 style="clear: both;">MushROOM</h1>
</a><br>
</div>
<div style="flex-grow: 4;"><span>Search mushrooms and recipes</span>
<div class="input-icons searchrow" style="gap: 8px; width: 50%;"><input type="text" id="Search"
class="input-field searchbar">
<div class="logorow column" style="flex-grow: 1;"><a href="search.html"><button id="searchButton" class="btn"><i
class="fa fa-search"></i> Search</button></a></div>
<button class="secondarybtn"><i class="fa fa-filter"></i> Filters</button>
</div>
</header>
<!-- //Header ends -->
<div class="container">
<div class="formcontainer">
<h2 id="welcome">Welcome to MushROOM</h2>
<label for="first-name">First Name:</label>
<input type="text" id="first-name" name="first-name" pattern="[A-Za-z]+" title="Only letters are allowed">
<br><br>
<label for="last-name">Last Name:</label>
<input type="text" id="last-name" name="last-name" pattern="[A-Za-z]+" title="Only letters are allowed">
<br><br>
<label for="phone">Phone Number:</label>
<input type="tel" id="phone" name="phone" pattern="[0-9]{10}" title="Only 10 digits are allowed">
<br><br>
<label for="address">Address:</label>
<input type="text" id="address" name="address">
<br><br>
<label for="email">Enter your email:</label>
<input type="email" id="email" name="email">
<br><br>
<label for="pwd">Password:</label>
<input type="password" id="pwd" name="pwd" pattern=".{6,}" title="Password must be at least 6 characters long">
<br><br>
<label for="DOB">Date of Birth:</label>
<input type="date" id="DOB" name="DOB">
<br>
<div style="display: inline; justify-content:stretch;"><input type="checkbox" id="newsletter" name="newsletter"
value="newsletter">
<label for="newsletter"> Subscribe to our Newsletter</label>
</div>
<br>
<div style="display: inline; justify-content:stretch;">
<input type="checkbox" id="terms" name="terms" value="terms">
<label for="terms"> Agree to our Terms and Conditions</label>
</div>
<br>
<button type="button" onclick="validateForm()" class="btn">Sign Up</button>
</div>
<div class="image-container">
<img src="images/mm.jpeg" alt="MushROOM Image" style="width: 500px">
</div>
</div>
<!--FOOTER -->
<footer>
<br>
All rights reserved by MushROOM Media. 2023
</footer>
<!--FOOTER ends -->
<script>
function validateForm() {
var firstName = document.getElementById("first-name").value;
var lastName = document.getElementById("last-name").value;
var phone = document.getElementById("phone").value;
var password = document.getElementById("pwd").value;
var firstNameRegex = /^[A-Za-z]+$/;
var phoneRegex = /^[0-9]{10}$/;
var passwordRegex = /^.{6,}$/;
var errors = [];
if (!firstNameRegex.test(firstName)) {
errors.push("First name should only contain letters");
}
if (!firstNameRegex.test(lastName)) {
errors.push("Last name should only contain letters");
}
if (!phoneRegex.test(phone)) {
errors.push("Phone number should be 10 digits");
}
if (!passwordRegex.test(password)) {
errors.push("Password must be at least 6 characters long");
}
var message = "";
if (errors.length === 0) {
message = "Registration is successful! Welcome to MushROOMS";
window.location.replace("index.html");
} else {
message = "Registration failed. Errors:\n" + errors.join("\n");
}
alert(message);
}
</script>
</body>
</html>