Skip to content

The Open Source DocuSign Alternative.

fix(bug): name field can be updated with spaces #555 (#558)

Aditya Deshlahreb7950cf04274
diff --git a/apps/web/src/app/(signing)/sign/[token]/form.tsx b/apps/web/src/app/(signing)/sign/[token]/form.tsx
index 36a54879c..17872a7ab 100644
--- a/apps/web/src/app/(signing)/sign/[token]/form.tsx
+++ b/apps/web/src/app/(signing)/sign/[token]/form.tsx
@@ -99,7 +99,7 @@ export const SigningForm = ({ document, recipient, fields }: SigningFormProps) =
id="full-name"
className="bg-background mt-2"
value={fullName}
- onChange={(e) => setFullName(e.target.value)}
+ onChange={(e) => setFullName(e.target.value.trimStart())}
/>
</div>
diff --git a/apps/web/src/app/(signing)/sign/[token]/name-field.tsx b/apps/web/src/app/(signing)/sign/[token]/name-field.tsx
index 275a6ede8..bbe18fb8a 100644
--- a/apps/web/src/app/(signing)/sign/[token]/name-field.tsx
+++ b/apps/web/src/app/(signing)/sign/[token]/name-field.tsx
@@ -125,7 +125,7 @@ export const NameField = ({ field, recipient }: NameFieldProps) => {
type="text"
className="mt-2"
value={localFullName}
- onChange={(e) => setLocalFullName(e.target.value)}
+ onChange={(e) => setLocalFullName(e.target.value.trimStart())}
/>
</div>
diff --git a/packages/trpc/server/field-router/schema.ts b/packages/trpc/server/field-router/schema.ts
index d6c3f90b2..051636477 100644
--- a/packages/trpc/server/field-router/schema.ts
+++ b/packages/trpc/server/field-router/schema.ts
@@ -3,7 +3,7 @@ import { z } from 'zod';
export const ZSignFieldWithTokenMutationSchema = z.object({
token: z.string(),
fieldId: z.number(),
- value: z.string(),
+ value: z.string().trim(),
isBase64: z.boolean().optional(),
});