Skip to content

Commit

Permalink
Merge pull request #432 from saketh-05/fixes
Browse files Browse the repository at this point in the history
Added email pattern verification
  • Loading branch information
SUGAM-ARORA authored Jul 13, 2024
2 parents 2aeffc8 + e59a98f commit c8d56af
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions src/Components/footer_section/ContactUs/contact_us.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,30 @@ function ContactUs() {
event.preventDefault();
// Perform form validation or any other logic here

// Show success toast notification
toast.success('Sent Successfully!', {
position: "top-center",
autoClose: 5000,
hideProgressBar: false,
closeOnClick: true,
pauseOnHover: false,
draggable: true,
progress: undefined,
theme: "dark",
transition: Bounce,
});
const email = document.getElementById("email").value;
const name = document.getElementById("flname").value;
const emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;

if (!emailPattern.test(email)) {
toast.error("Please enter a valid email address.");
return;
} else if (name.length < 2 || name.length > 40) {
toast.error("Name should be within 2 - 40 characters only.");
return;
}
// Show success toast notification
toast.success("Sent Successfully!", {
position: "top-center",
autoClose: 5000,
hideProgressBar: false,
closeOnClick: true,
pauseOnHover: false,
draggable: true,
progress: undefined,
theme: "dark",
transition: Bounce,
});
};

return (
<div className='box'>
Expand Down

0 comments on commit c8d56af

Please sign in to comment.