forked from ML-Fusion-Lab/ML-Fusion-Lab-Website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
feedback.html
207 lines (173 loc) · 6.32 KB
/
feedback.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Feedback Page</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
/* Replace this URL with your actual image link */
background: url(https://plus.unsplash.com/premium_photo-1682756540097-6a887bbcf9b0?q=80&w=1471&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D) no-repeat center center fixed;
background-size: cover;
/* Ensure content is centered */
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
background-color: white;
padding: 20px;
border-radius: 12px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
width: 500px;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
position: relative;
margin-bottom: 20px;
}
h2 {
position: absolute;
left: 50%;
transform: translateX(-50%);
text-align: center;
margin: 0;
font-size: 1.5em;
font-weight: bold;
}
label {
display: block;
text-align: left;
margin-top: 10px;
}
input, select, textarea {
width: 100%;
padding: 15px;
margin: 10px 0;
border-radius: 14px;
border: 1px solid #ccc;
}
button {
background-color:#216988;
color: white;
padding: 10px 15px;
border: none;
border-radius: 4px;
cursor: pointer;
margin: 5px;
box-shadow: 0px 8px 0px rgba(0, 0, 0, 1);
}
button:active {
background-color: #093e55;
box-shadow: 0 4px 0 rgba(0, 0, 0, 1);
transform: translateY(4px);
}
.hidden {
display: none;
}
#feedbackResponse h3 {
color: #28a745;
margin-bottom: 10px;
}
.back-link {
display: inline-block;
background-color: #00c6ff;
color: white;
padding: 8px 10px;
text-decoration: none;
border-radius: 10px;
font-size: 0.9em;
}
.back-link:hover {
background-color: #216988;
}
#feedbackForm, #feedbackResponse {
text-align: center;
}
textarea {
height: 200px;
resize: none;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<a href="index.html" class="back-link">←</a>
<h2>Feedback Form</h2>
</div>
<form id="feedbackForm" onsubmit="return submitFeedback()">
<label for="name">Name:</label>
<input type="text" id="name" name="name" placeholder="Enter Name" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" placeholder="Enter Email id" required>
<label for="rating">Rating:</label>
<select id="rating" name="rating" required>
<option value="" disabled selected>Select rating</option>
<option value="1">1 - Poor</option>
<option value="2">2 - Fair</option>
<option value="3">3 - Good</option>
<option value="4">4 - Very Good</option>
<option value="5">5 - Excellent</option>
</select>
<label for="comments">Comments:</label>
<textarea id="comments" name="comments" placeholder="Enter comment" required></textarea>
<button type="submit">Submit Feedback</button>
</form>
<div id="feedbackResponse" class="hidden">
<h3>Thank you for your feedback!</h3>
<p id="responseMessage"></p>
<button onclick="resetForm()">Submit another feedback</button>
</div>
</div>
<script>
// Function to handle form submission
function submitFeedback() {
// Get form data
const name = document.getElementById('name').value;
const email = document.getElementById('email').value;
const rating = document.getElementById('rating').value;
const comments = document.getElementById('comments').value;
// Validate the form inputs
if (!name || !email || !rating || !comments) {
alert('Please fill out all fields');
return false;
}
// Create a feedback object
const feedback = {
name: name,
email: email,
rating: rating,
comments: comments
};
// Retrieve existing feedbacks from local storage, if any
let feedbacks = JSON.parse(localStorage.getItem('feedbacks')) || [];
// Add new feedback to the feedback array
feedbacks.push(feedback);
// Store updated feedback array back in local storage
localStorage.setItem('feedbacks', JSON.stringify(feedbacks));
// Show the feedback response message
document.getElementById('feedbackResponse').classList.remove('hidden');
document.getElementById('feedbackForm').classList.add('hidden');
document.getElementById('responseMessage').innerText = `Thank you, ${name}, for your feedback!`;
// Reset the form
document.getElementById('feedbackForm').reset();
return false; // Prevent page reload
}
// Function to reset the form and show it again
function resetForm() {
document.getElementById('feedbackForm').classList.remove('hidden');
document.getElementById('feedbackResponse').classList.add('hidden');
}
</script>
</body>
</html>