diff --git a/src/components/client/donation-flow/steps/payment-method/PaymentDetailsStripeForm.tsx b/src/components/client/donation-flow/steps/payment-method/PaymentDetailsStripeForm.tsx index ad40a329e..6e68dbd1e 100644 --- a/src/components/client/donation-flow/steps/payment-method/PaymentDetailsStripeForm.tsx +++ b/src/components/client/donation-flow/steps/payment-method/PaymentDetailsStripeForm.tsx @@ -81,9 +81,9 @@ export default function PaymentDetailsStripeForm({ placeholder={t('donation-flow:step.payment-method.field.card-data.name-label')} onInput={(e) => { const input = e.target as HTMLInputElement - if (!/^[a-zA-Z\s]+$/.test(input.value)) { - input.value = input.value.replace(/[^a-zA-Z\s]/g, '') - } + input.value = input.value + .replace(/[^a-zA-Z\s-]/g, '') + .replace(/[-\s]{2,}/g, (match) => match[0]) }} />