diff --git a/src/components/ContactUs.jsx b/src/components/ContactUs.jsx index dfc08d2..e90725d 100644 --- a/src/components/ContactUs.jsx +++ b/src/components/ContactUs.jsx @@ -16,14 +16,19 @@ const ContactUs = () => { e.preventDefault() if(!name.trim() || !message.trim() || !email.trim() || !number.trim()){ alert("Fill all the fields") + return } - else if(name.trim() || message.trim() || email.trim() || number.trim()){ - alert("Message sent successfully") - setName("") - setMessage("") - setEmail("") - setNumber("") + + if(!name.match(/^[a-z]+$/i)){ + alert("Only alphabets are allowed in name") + return } + + alert("Message sent successfully") + setName("") + setMessage("") + setEmail("") + setNumber("") } @@ -58,21 +63,19 @@ const ContactUs = () => {