-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontact.html
267 lines (234 loc) · 8.4 KB
/
contact.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Contact Form</title>
<link rel="stylesheet" href="public/css/contact.css" />
<!-- favicons
================================================== -->
<link rel="apple-touch-icon" sizes="180x180" href="public/images/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="public/images/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="public/images/favicon-16x16.png" />
<!-- <link rel="manifest" href="site.webmanifest"> -->
<script src="https://kit.fontawesome.com/64d58efce2.js" crossorigin="anonymous"></script>
<script src="connection/contact.js"></script>
<script type="text/javascript">
function validateName() {
var name = document.getElementById("contact-name").value;
if (name.length == 0) {
// producePrompt('Name is required', 'name-error' , 'red')
return false;
}
// if (!name.match(/^[A-Za-z]*\s{1}[A-Za-z]*$/)) {
// //producePrompt('First and last name, please.','name-error', 'red');
// return false;
// }
//producePrompt('Valid', 'name-error', 'green');
return true;
}
function validatePhone() {
var phone = document.getElementById("contact-phone").value;
if (phone.length == 0) {
//producePrompt('Phone number is required.', 'phone-error', 'red');
return false;
}
if (phone.length != 10) {
//producePrompt('Include area code.', 'phone-error', 'red');
return false;
}
if (!phone.match(/^[0-9]{10}$/)) {
//producePrompt('Only digits, please.' ,'phone-error', 'red');
return false;
}
//producePrompt('Valid', 'phone-error', 'green');
return true;
}
function validateEmail() {
var email = document.getElementById("contact-email").value;
if (email.length == 0) {
//producePrompt('Email Invalid','email-error', 'red');
return false;
}
if (!email.match(/^[A-Za-z\._\-[0-9]*[@][A-Za-z]*[\.][a-z]{2,4}$/)) {
//producePrompt('Email Invalid', 'email-error', 'red');
return false;
}
//producePrompt('Valid', 'email-error', 'green');
return true;
}
function validateMessage() {
var message = document.getElementById("contact-message").value;
var required = 10;
var left = required - message.length;
if (left > 0) {
producePrompt(
left + " more characters required",
"message-error",
"white"
);
return false;
}
producePrompt("Valid", "message-error", "white");
return true;
}
function validateForm() {
if (
!validateName() ||
!validatePhone() ||
!validateEmail() ||
!validateMessage()
) {
jsShow("submit-error");
producePrompt(
"Please fix errors to submit.",
"submit-error",
"white"
);
setTimeout(function () {
jsHide("submit-error");
}, 2000);
return false;
} else {
}
}
function jsShow(id) {
document.getElementById(id).style.display = "block";
}
function jsHide(id) {
document.getElementById(id).style.display = "none";
}
function producePrompt(message, promptLocation, color) {
document.getElementById(promptLocation).innerHTML = message;
document.getElementById(promptLocation).style.color = color;
}
</script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@emailjs/browser@3/dist/email.min.js"></script>
<script type="text/javascript">
(function () {
emailjs.init("qOlUCrdbuGxGV8Pu2");
})();
</script>
<script type="text/javascript">
// const ss = document.querySelector(".btn");
// ss.window.location.reload(true);
window.onload = function () {
document
.getElementById("contact-form")
.addEventListener("submit", function (event) {
const alertbox = document.getElementById("done");
alertbox.style.visibility = "visible";
alertbox.innerHTML
event.preventDefault();
emailjs
.sendForm("service_75pueug", "template_7g41098", this)
.then(producePrompt("Contact Form Submitted ✔", "done", "white"))
.then(
async function () {
console.log("SUCCESS!");
await setInterval(window.location.reload(), 10000);
},
function (error) {
console.log("FAILED...", error);
}
);
});
};
</script>
</head>
<body>
<div class="loader_bg">
<div class="loader"></div>
</div>
<div class="container">
<div class="done" id="done">
</div>
<span class="big-circle"></span>
<img src="public/images/shape.png" class="square" alt="" />
<div class="form">
<div class="contact-info">
<h3 class="title">Let's get in touch</h3>
<p class="text">
Do fill the form to get in touch wih us. We will try our fullest to answer your queries within 48hrs !!
</p>
<div class="info">
<div class="information">
<img src="public/images/location.png" class="icon" alt="" />
<p>ABV-IIITM Gwalior, IN 474015</p>
</div>
<div class="information">
<img src="public/images/email.png" class="icon" alt="" />
<p>upsilonquery@gmail.com</p>
</div>
<div class="information">
<img src="public/images/phone.png" class="icon" alt="" />
<p>123-456-789</p>
</div>
</div>
<div class="social-media">
<div class="form-submit" id="form-submit"></div>
<!-- <p>Connect with us :</p> -->
<div class="social-icons">
<!-- <a href="#">
<i class="fab fa-facebook-f"></i>
</a>
<a href="#">
<i class="fab fa-twitter"></i>
</a>
<a href="#">
<i class="fab fa-instagram"></i>
</a>
<a href="#">
<i class="fab fa-linkedin-in"></i>
</a> -->
</div>
</div>
</div>
<div class="contact-form">
<span class="circle one"></span>
<span class="circle two"></span>
<form id="contact-form" action="contact.html" autocomplete="off">
<h3 class="title">Contact us</h3>
<div class="input-container">
<input type="text" name="from_name" class="input" id="contact-name" onkeyup="validateName()" />
<label for="">Username</label>
<span>Username</span>
<div class="error-message" id="name-error"></div>
</div>
<div class="input-container">
<input type="email" name="email_id" class="input" id="contact-email" onkeyup="validateEmail()" />
<label for="">Email</label>
<span>Email</span>
<div class="error-message" id="email-error"></div>
</div>
<div class="input-container">
<input type="tel" name="phone" class="input" id="contact-phone" onkeyup="validatePhone()" />
<label for="">Phone</label>
<span>Phone</span>
<div class="error-message" id="phone-error"></div>
</div>
<div class="input-container textarea">
<textarea name="message" class="input" id="contact-message" onkeyup="validateMessage()"></textarea>
<label for="">Message</label>
<span>Message</span>
<div class="error-message" id="message-error"></div>
</div>
<a href="/contact.html">
<input type="submit" value="Send" class="btn" onclick="return validateForm();" />
</a>
<div class="error-message" id="submit-error"></div>
</form>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
setTimeout(function () {
$(".loader_bg").fadeToggle();
}, 1500);
</script>
<script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script>
<script nomodule src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
<script src="public/js/contact.js"></script>
</body>
</html>