Skip to content

Commit

Permalink
Merge pull request #1483 from KrishPatel1205/branch3
Browse files Browse the repository at this point in the history
Update give_feedback.html
  • Loading branch information
ANSHIKA-26 authored Oct 27, 2024
2 parents 08e9bb8 + 3e66504 commit bdaca0c
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions give_feedback.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="Scroll_and_progressbar.css" />
<script src="give_feedback.js" defer></script>

<style>
/* Custom popup styles */
.send-btn {
Expand Down Expand Up @@ -552,20 +554,31 @@ <h3>Message Sent</h3>
const feedbackResult = document.getElementById('feedback-result');

submitBtn.addEventListener('click', () => {
const name = document.getElementById('Name').value;
const email = document.getElementById('email2').value;
const message = document.getElementById('message').value;
const name = document.getElementById('Name').value.trim();
const email = document.getElementById('email2').value.trim();
const message = document.getElementById('message').value.trim();
const rating = document.querySelector('input[name="rating"]:checked')?.value;


// Email validation regex
const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;

// Validate name
if (name === '') {
alert('Please enter your name!');
return; // Stop execution if name is empty
}

// Validate email
if (!emailPattern.test(email)) {
alert('Please enter a valid email address.');
alert('Please enter a valid email address!');
return; // Stop execution if email is invalid
}

if (message === '') {
alert('Please enter a feedback message!');
return; // Stop execution if name is empty
}

// Display feedback result in popup
feedbackResult.innerHTML = `Thank you, ${name}!<br>Your feedback: ${message}<br>Rating: ${rating} stars`;
Expand Down Expand Up @@ -732,6 +745,8 @@ <h2 class="footer-title secondary-title mt-5">Connect with us</h2>
<script src="./darkMode.js"></script>

<script src="progress_bar.js"></script>
<script src="give_feedback.js"></script>


<script src="main.js"></script>

Expand Down

1 comment on commit bdaca0c

@vercel
Copy link

@vercel vercel bot commented on bdaca0c Oct 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.