Skip to content

fix(frontend): add Full Name and Work Email validation in ContactSales Get Started form - #4035

Open
Aryanbansal-05 wants to merge 1 commit into
riteshbonthalakoti:gssocfrom
Aryanbansal-05:Aryan-05-25
Open

fix(frontend): add Full Name and Work Email validation in ContactSales Get Started form#4035
Aryanbansal-05 wants to merge 1 commit into
riteshbonthalakoti:gssocfrom
Aryanbansal-05:Aryan-05-25

Conversation

@Aryanbansal-05

Copy link
Copy Markdown

🎯 Summary

Resolves #4031 by adding client-side validation to the Full Name and Work Email fields in the ContactSales form, preventing invalid values like a12d! or abc@a from being submitted.


🛠️ Changes Made

Frontend/src/pages/ContactSales.tsx

Added errors state to track field-level validation errors.

Added validateForm() function:

  • Full Name: validated against /^[a-zA-Z\s'\-]{2,100}$/ — only letters, spaces, hyphens, apostrophes allowed
  • Work Email: validated against /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/ — requires valid domain with TLD (e.g. john@company.com, rejects abc@a)

Updated handleSubmit():

  • Calls validateForm() before submission — blocks submit if validation fails

Updated handleChange():

  • Clears field error on user input for better UX

Added inline error messages:

  • Red border on invalid fields
  • Error text displayed below Full Name and Work Email inputs

✅ Fixes

  • a12d! rejected in Full Name field with clear error message
  • abc@a rejected in Work Email field — requires valid TLD
  • Numbers and special characters blocked in Full Name
  • Form no longer proceeds to submission with invalid values
  • Error clears automatically when user corrects the input

Closes #4031

@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown

@Aryanbansal-05 is attempting to deploy a commit to the ritesh Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: af12f804-e2fc-4d9a-87a0-b8f6391d4838

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Aryanbansal-05

Copy link
Copy Markdown
Author

Hi @riteshbonthalakoti! The issue has been resolved and the PR is ready to get merged. Thankyou!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant