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 = () => {
Contact us for a quote
Get a quote
-
- { +
handleSubmit(e)}> + { setName(e.target.value) }} className="rounded-xl h-10 w-72 p-3 " placeholder="Name: eg- Elon Mask"/> - { + { setEmail(e.target.value) }} className="rounded-xl h-10 w-72 p-3" placeholder="Email: eg- Elon@gmail.com"/> - { - setNumber(e.target.value) - }} className="rounded-xl h-10 w-72 p-3" placeholder="Phone no.: eg- 65654-56554"/> -