-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathform.html
299 lines (250 loc) · 9.87 KB
/
form.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="form.css">
<script src="https://kit.fontawesome.com/8da8ffa530.js" crossorigin="anonymous"></script>
<script src="validation.js" defer ></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js" ></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.3/jquery.validate.min.js" ></script>
<script src="form.js" defer></script>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
<header>
<div class="head">
<img src="VJTI_LOGO.png" id="photo" alt="Profile photo" height="5%" width="5%">
<h1 id="c1">Candidate Registartion</h1>
<h3 id="c2">Fill the below details to apply for the Course</h3>
</div>
</header>
<nav>
<ul>
<li><a href="home.html">Home</a></li>
<li><a href="form.html">Registration Form</a></li>
<li><a href="config/dashboard.php">Data Analytics Dashboard</a></li>
<li><a href="WIM_Profile/index.html">My Profile</a></li>
<li><a href="config/display.php">Registered Candidate's Data</a></li>
</ul>
</nav>
<form id="regForm" action="formInsert.php" method="post">
<!-- One "tab" for each step in the form: -->
<div class="tab">
<h1>Personal Details</h1>
<div class="input-icons">
First Name:
<p><i class="fa-solid fa-user"></i><input type="text" placeholder="First name..." oninput="this.className = ''"
name="fname" id="fname"></p>
Last Name :
<p><i class="fa-solid fa-user"></i><input type="text" placeholder="Last name..." oninput="this.className = ''"
name="lname" id="lname" required></p>
E-mail:
<p><i class="fa-solid fa-envelope"></i><input placeholder="E-mail..." oninput="this.className = ''" name="email"
type="email" class="email" id="email" required></p>
<button id="email-verify-button" type="button" onclick="sendOTP()">Verify</button>
<br>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
function sendOTP() {
const emailInput = $("#email").val();
// Check if the email input is valid
var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!regex.test(emailInput)) {
alert("Invalid email address");
return;
}
// Send a request to the RapidAPI service
const settings = {
async: true,
crossDomain: true,
url: 'https://email-authentication-system.p.rapidapi.com/?recipient=' + emailInput + '&app=Login%20System',
method: 'GET',
headers: {
'X-RapidAPI-Key': '4ba6d0fe43msh039a4977aa8c76fp13b079jsn7b2f0d218283',
'X-RapidAPI-Host': 'email-authentication-system.p.rapidapi.com'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
// Handle the response here, e.g., display a success message
// or trigger the OTP verification process.
alert("OTP sent to your email.");
// Redirect to an OTP verification page
window.location.href = 'otp.html';
}).fail(function (xhr, status, error) {
console.error(error);
alert("Failed to send OTP. Please try again later.");
});
}
</script>
Phone No.:
<p><i class="fa-solid fa-phone"></i><input placeholder="Phone..." oninput="this.className = ''" name="phone" id="pno"
required></p>
<button onclick="window.location.href = 'otp.html'" type="button">Verify</button>
<br>
Address:
<p><i class="fa-solid fa-address-book"></i><input placeholder="Address..." oninput="this.className = ''"
name="address" required></p>
</div>
</div>
<div class="tab">
<h1> Details</h1>
<div class="input-icons">
Birth Date :
<p><i class="fa-solid fa-calendar-days"></i><input type="date" placeholder="dd-mm-yyyy" oninput="this.className = ''" name="bdate" id="bdate" required></p>
<label for="Nationality">Nationality : </label>
<select id="na" name="nationality" required>
<option selected hidden value="">Select Nationality</option>
<option value="Indian">Indian</option>
<option value="American">American</option>
<option value="Nepal">Nepal</option>
</select>
<label for="Gender">Gender : </label>
<select id="Gender" name="gender" required>
<option selected hidden value="">Select Gender</option>
<option value="Male">Male</option>
<option value="Female">Female</option>
<option value="Other">Other</option>
</select>
<br>
Aadhar No.:
<p><i class="fa-solid fa-address-card"></i><input placeholder="Enter Aadhar No." oninput="this.className = ''" name="aadhar" id="add" required></p>
</div>
</div>
<div class="tab">
<h1>Qualification</h1>
<div class="input-icons">
<label for="Highest Degree">Highest Degree : </label>
<select id="deg" name="degree" required>
<option selected hidden value="">Select Degree</option>
<option value="B.tech.">B.tech.</option>
<option value="B.E.">B.E.</option>
<option value="M.tech">M.tech</option>
<option value="M.E.">M.E.</option>
</select>
<br>
<label for="Course Name">Course Name : </label>
<select id="cu" name="course" required>
<option selected hidden value="">Select Degree</option>
<option value="Information Technology">Information Technology</option>
<option value="Computer Science">Computer Science</option>
<option value="Mechanicle">Mechanicle</option>
<option value="Extc">Extc</option>
<option value="Civil">Civil</option>
<option value="Electricle">Electricle</option>
</select>
<br>
CGPA/CPI:
<p ><i class="fa-solid fa-square-poll-vertical"></i><input placeholder="Enter CGPA/CPI" type="text" oninput="this.className = ''" name="CPI" id="cpi" required></p>
<button type="submit" onclick="window.location.href='pdf.html';">Generate PDF</button>
</div>
</div>
<div style="overflow:auto;">
<div style="float:right;">
<button type="button" id="prevBtn" onclick="nextPrev(-1)">Previous</button>
<button type="button" id="nextBtn" onclick="nextPrev(1)">Next</button>
</div>
</div>
<!-- Circles which indicates the steps of the form: -->
<div style="text-align:center;margin-top:40px;">
<span class="step"></span>
<span class="step"></span>
<span class="step"></span>
</div>
</form>
<script>
jQuery('#regForm').validate({
rules :{
fname:'required',
email:{
required:true,
email:true
},
lname:{
required:true
},
address:"required",
bdate:"required",
gender:"required",
aadhar:"required",
degree:"required",
course:"required",
CPI:"required"
},messages:{
fname:{
required:'Please enter your first name'
},
lname:{
required:"Please enter your last name"
},
email:{
required:"Please enter email address",
email:"Please enter valid email address"
},
address:{
required:"Please enter your address"
},
degree:{
required:"Please enter your degree"
},
bdate:{
required:"Please enter your bdate"
},
gender:{
required:"Please enter gender"
},
CPI:{
required:"Please enter your CPI "
},
course:{
required:"Please enter your course"
},
}
});
</script>
<script>
const form = document.getElementById('regForm');
const fname = document.getElementById('fname');
form.addEventListener('submit',function(e){
e.preventDefault();
const firstNameValue = fname.value;
const lastNameValue = lname.value;
const emailVal = email.value;
const pnoVal = pno.value;
const addVal = add.value;
const bdateVal = bdate.value;
const naVal = na.value;
const GenderVal = Gender.value;
const degVal = deg.value;
const cuVal = cu.value;
const cpiVal = cpi.value;
localStorage.setItem('fname',firstNameValue);
localStorage.setItem('lname',lastNameValue);
localStorage.setItem('email',emailVal);
localStorage.setItem('pno',pnoVal);
localStorage.setItem('add',addVal);
localStorage.setItem('bdate',bdateVal);
localStorage.setItem('na',naVal);
localStorage.setItem('Gender',GenderVal);
localStorage.setItem('deg',degVal);
localStorage.setItem('cu',cuVal);
localStorage.setItem('cpi',cpiVal);
window.location.href='pdf.html';
})
</script>
<script type="text/javascript">
$(document).ready(function () {
$(".email").change(function () {
var inputvalues = $(this).val();
var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if(!regex.test(inputvalues)){
alert("invalid email id");
return regex.test(inputvalues);
}
});
});
</script>
</body>
</html>