From 4d823b9fbb949a03ab91eea2c0602d15987b12db Mon Sep 17 00:00:00 2001 From: rockyeverlast Date: Mon, 29 Apr 2024 20:40:25 +0530 Subject: [PATCH] Form added --- src/components/Contact/Form.jsx | 86 ++++++++++++++++++++++----------- 1 file changed, 58 insertions(+), 28 deletions(-) diff --git a/src/components/Contact/Form.jsx b/src/components/Contact/Form.jsx index 87b7da7..4ddfd16 100644 --- a/src/components/Contact/Form.jsx +++ b/src/components/Contact/Form.jsx @@ -29,6 +29,8 @@ import forml from "../../assets/images/forml.png"; import { Link } from "react-router-dom"; import ReCAPTCHA from "react-google-recaptcha"; import { contactUs } from "../../service/api"; +import PhoneInput from "react-phone-input-2"; +import "react-phone-input-2/lib/style.css"; const Contact = () => { const { @@ -45,6 +47,11 @@ const Contact = () => { // const email = "rubix@gmail.com"; + const preprocessPhoneNumber = (value) => { + // Remove any non-digit characters from the phone number + return value.replace(/\D/g, ""); + }; + const handleVerify = (token) => { setRecaptchaToken(token); }; @@ -58,6 +65,7 @@ const Contact = () => { // reset(); // } + // console.log(data.phone); try { const result = await contactUs(data); if (result.status) { @@ -432,7 +440,7 @@ const Contact = () => { value: /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/, message: "Please enter a valid email address", }, - required: true, + required: "Email ID is required", })} /> {errors.email && ( @@ -453,34 +461,55 @@ const Contact = () => { > Phone* - ( + + )} /> + {/* */} {errors.phone && (

{errors.phone.message} @@ -528,6 +557,7 @@ const Contact = () => { + )} />