From 5f8425a766193ce63b459e2c16a6474f1e43e3c4 Mon Sep 17 00:00:00 2001 From: Nancy-3012 Date: Sun, 2 Aug 2026 23:35:34 +0530 Subject: [PATCH] fix(frontend): add Company Website field with URL validation in ContactSales form --- Frontend/src/pages/ContactSales.tsx | 43 ++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/Frontend/src/pages/ContactSales.tsx b/Frontend/src/pages/ContactSales.tsx index 6003d5140..c91a2f8af 100644 --- a/Frontend/src/pages/ContactSales.tsx +++ b/Frontend/src/pages/ContactSales.tsx @@ -50,12 +50,13 @@ export default function ContactSales() { : DEFAULT_COMPANY_SIZE; return { - name: '', - email: '', - company: '', - phone: '', - company_size: companySizeInit, - message: '' + name: '', + email: '', + company: '', + website: '', + phone: '', + company_size: '50-200', + message: '' }; }); @@ -67,8 +68,15 @@ export default function ContactSales() { } }; - const handleSubmit = async (e) => { + const handleSubmit = async (e) => { e.preventDefault(); + if (formData.website.trim()) { + const urlRegex = /^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/i; + if (!urlRegex.test(formData.website.trim())) { + alert('Please enter a valid website URL (e.g. https://company.com).'); + return; + } + } setIsSubmitting(true); try { @@ -241,9 +249,30 @@ export default function ContactSales() { onChange={handleChange} /> + + + +
+ +
+
+ +
+
+
+ +
+