From 145bf9aeedb88ded671b1f1b4700235379a11143 Mon Sep 17 00:00:00 2001
From: Michael Hunteman <michael@huntm.net>
Date: Wed, 10 Jul 2024 17:43:59 -0700
Subject: Trim whitespace

---
 client/src/components/RsvpForm.tsx | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'client/src/components/RsvpForm.tsx')

diff --git a/client/src/components/RsvpForm.tsx b/client/src/components/RsvpForm.tsx
index d981053..4454c77 100644
--- a/client/src/components/RsvpForm.tsx
+++ b/client/src/components/RsvpForm.tsx
@@ -131,6 +131,7 @@ function RsvpForm() {
             helperText={errors.email?.message}
             required
             {...register('email', {
+              setValueAs: (value: string) => value.trim(),
               required: 'This field is required',
               pattern: {
                 value: /\S+@\S+\.\S+/,
@@ -191,6 +192,7 @@ function RsvpForm() {
                   helperText={errors.partyList?.[index]?.firstName?.message}
                   required
                   {...register(`partyList.${index}.firstName`, {
+                    setValueAs: (value: string) => value.trim(),
                     required: 'This field is required',
                   })}
                 />
@@ -204,6 +206,7 @@ function RsvpForm() {
                   helperText={errors.partyList?.[index]?.lastName?.message}
                   required
                   {...register(`partyList.${index}.lastName`, {
+                    setValueAs: (value: string) => value.trim(),
                     required: 'This field is required',
                   })}
                 />
-- 
cgit v1.2.3

