Skip to content

Commit

Permalink
Merge pull request #463 from amantaphelix/main
Browse files Browse the repository at this point in the history
Validate and Alert Users for Empty Form Submissions
  • Loading branch information
hustlerZzZ authored Jul 30, 2024
2 parents 189a8a7 + f4a121d commit 9606082
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/pages/ContactUs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ const Contact = () => {

const handleEmailSubmit = async (e) => {
e.preventDefault();
if (!form.name || !form.email || !form.message) {
alert("Please fill in all fields before submitting.");
return; // Stop further processing if form is incomplete
}
setLoading(true);

try {
Expand Down Expand Up @@ -62,6 +66,10 @@ const Contact = () => {
};
const handleSaveToDB = async (e) => {
e.preventDefault();
if (!form.name || !form.email || !form.message) {
alert("Please fill in all fields before submitting.");
return; // Stop further processing if form is incomplete
}
setLoading(true);

try {
Expand Down

0 comments on commit 9606082

Please sign in to comment.