-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathindex.html
83 lines (82 loc) · 4.14 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Comic+Neue:ital,wght@0,300;0,400;0,700;1,300;1,400;1,700&family=Doto:wght@100..900&family=DynaPuff:wght@400..700&family=Kablammo&family=Share+Tech+Mono&display=swap" rel="stylesheet">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Comic+Neue:ital,wght@0,300;0,400;0,700;1,300;1,400;1,700&family=Doto:wght@100..900&family=DynaPuff:wght@400..700&family=Kablammo&display=swap" rel="stylesheet">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>NST-SDC</title>
<link rel="icon" href="/NST_SDC/photos/NST-SDC.png" type="image/jpeg">
<link rel="stylesheet" href="/NST_SDC/css/index.css">
<script defer data-domain="nstsdc.org" src="https://plausible.io/js/script.js"></script>
<script>
function setMinDOB() {
const dobInput = document.getElementById('DOB');
const today = new Date();
const minDOB = new Date(today.getFullYear() - 16, today.getMonth(), today.getDate());
dobInput.max = minDOB.toISOString().split("T")[0];
}
window.onload = setMinDOB;
function validateAndRedirect(event) {
event.preventDefault();
const form = document.querySelector('form');
if (form.checkValidity()) {
const actionButton = event.submitter; //// Identify which button was clicked
if (actionButton && actionButton.value === "Log in") {
window.location.href = 'home.html';
} else {
window.location.href = 'signup.html';
}
} else {
form.reportValidity(); ////// Show validation messages if invalid
}
}
</script>
</head>
<body>
<div class="form">
<form action="http://localhost:3000/submit" method="post" onsubmit="validateAndRedirect(event)">
<div class="data0">
<label for="role">Role: </label>
<select name="role" id="role" required>
<option value="member">Member</option>
<option value="admin">Admin</option>
<option value="students" selected>Students</option>
</select>
</div>
<div class="data1">
<label for="name">Name: </label>
<input type="text" id="name" name="name" placeholder="Enter your name" required>
</div>
<div class="data2">
<label>Batch</label>
<input type="radio" id="A" name="Batch" value="A" required>
<label for="A">A</label>
<input type="radio" id="B" name="Batch" value="B">
<label for="B">B</label>
<input type="radio" id="C" name="Batch" value="C">
<label for="C">C</label>
</div>
<div class="data3">
<label for="urn">URN:</label>
<input type="text" id="urn" name="urn" placeholder="Enter your URN" required>
<br>
<label for="DOB">Date of Birth</label>
<input type="date" id="DOB" name="D.O.B" required onfocus="setMinDOB()">
<br>
<label for="email">Email: </label>
<input type="email" id="email" name="email" placeholder="Enter your email" required>
</div>
<div class="data4">
<label for="pass">Password</label>
<input type="password" id="pass" name="password" placeholder="Enter your password" required>
</div>
<div class="data4">
<button type="submit" name="action" value="Log in">Log in</button>
<button type="submit" name="action" value="Sign up">Sign up</button>
</div>
</form>