Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Star rating to the feedback form #289

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 38 additions & 8 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@
<div class="scrollBar" id="progress_bar"></div> <!--PROGRESS BAR-->
<a href="website/login.html">
<button class="loginSignupbtn">
<span class="button-text">Login</span>
<img src="website/web_images/user.png" alt="User Icon" class="user-icon">
<span class="button-text">Login</span>
<img src="website/web_images/user.png" alt="User Icon" class="user-icon">
</button>
</a>
</a>
</nav>

<button class="burger" id="burger" onclick="show()"></button>
Expand Down Expand Up @@ -250,12 +250,42 @@
</div>
</div>
<form name="Dataverse Reviews" method="POST" data-netlify="true" onsubmit="return validateForm()">
<p style="color:white">Let Me Know Your Thoughts!</p>
<input type="text" name="Name" placeholder="Your Name" required>
<input type="email" name="Email" placeholder="Your Email ID" required>
<input name="Message" placeholder="Your Message" required>
<input type="submit" value="Send" id="send">
<p style="color:white; font-size: 1.2em; font-weight: bold; text-align: center;">Let Me Know Your Thoughts!
</p>

<input type="text" name="Name" placeholder="Your Name" required
style="margin: 5px; padding: 10px; border-radius: 5px;">
<input type="email" name="Email" placeholder="Your Email ID" required
style="margin: 5px; padding: 10px; border-radius: 5px;">
<input name="Message" placeholder="Your Message" required
style="margin: 5px; padding: 10px; border-radius: 5px;"></textarea>

<div class="star-rating" style="text-align: center; margin: 10px;">
<input type="radio" id="star5" name="rating" value="5" />
<label for="star5" title="5 star">&#9733;</label>
<input type="radio" id="star4" name="rating" value="4" />
<label for="star4" title="4 stars">&#9733;</label>
<input type="radio" id="star3" name="rating" value="3" />
<label for="star3" title="3 stars">&#9733;</label>
<input type="radio" id="star2" name="rating" value="2" />
<label for="star2" title="2 stars">&#9733;</label>
<input type="radio" id="star1" name="rating" value="1" />
<label for="star1" title="1 stars">&#9733;</label>
</div>

<input type="submit" value="Send" id="send"
style="margin-top: 10px; padding: 10px 20px; border-radius: 5px; background-color: #444; color: white;">
</form>
<script>
function validateForm() {
const rating = document.querySelector('input[name="rating"]:checked');
if (!rating) {
alert("Please select a rating.");
return false; // Prevent form submission
}
return true; // Allow form submission
}
</script>
</footer>
<div class="links">
<div class="small">
Expand Down
2 changes: 1 addition & 1 deletion website/script.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Array of city names
var cities = ["Pune", "Moradabad", "Dehradun","Rampur","Delhi","Coimbatore"];
var cities = ["Pune", "Moradabad", "Dehradun","Rampur","Delhi","Coimbatore", "Riyadh"];

// /preloader js styling
window.addEventListener('DOMContentLoaded', () => {
Expand Down
27 changes: 27 additions & 0 deletions website/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,35 @@ body.light-mode footer h3 {
transition: box-shadow 0.3s ease-in-out;
/* Smooth transition */
}
.star-rating {
display: flex;
justify-content: center;
direction: rtl; /* This reverses the order of the stars */
}

.star-rating input {
display: none;
/* Hide the radio buttons */
}

.star-rating label {
font-size: 2em;
/* Star size */
color: grey;
/* Default star color */
cursor: pointer;
}

.star-rating input:checked~label {
color: gold;
/* Gold color for selected stars */
}

.star-rating label:hover,
.star-rating label:hover~label {
color: gold;
/* Change color on hover */
}

.copy {
height: 20px;
Expand Down