From 66b7af877ad7f9222a3ef828e3622beb3e4d7011 Mon Sep 17 00:00:00 2001 From: Anton Gunnarsson Date: Mon, 19 Jan 2026 08:34:24 +0000 Subject: [PATCH] Merged in fix/loy-514-fix-validation-tracking-in-signup-form (pull request #3445) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix(LOY-514): Fix validation error tracking in SignupForm * Fix issue with form submit handling * Fix * Remove browser validation * Add automatic tracking of validatione rrors Approved-by: Rasmus Langvad Approved-by: Matilda Landström --- .../components/Forms/Signup/index.tsx | 46 +++++-------------- .../ChildSelector/ChildInfoSelector.tsx | 2 - .../Form/Country/CountryCombobox.tsx | 1 - .../components/Form/Country/CountrySelect.tsx | 1 - .../lib/components/Form/Date/index.tsx | 3 -- .../lib/components/Form/FormInput/index.tsx | 1 - .../components/Form/FormTextArea/index.tsx | 1 - .../lib/components/Form/Phone/index.tsx | 1 - .../lib/components/Input/Input.tsx | 2 - .../PasswordInput/PasswordInput.tsx | 1 - packages/tracking/lib/useFormTracking.ts | 31 +++++++++++++ 11 files changed, 43 insertions(+), 47 deletions(-) diff --git a/apps/scandic-web/components/Forms/Signup/index.tsx b/apps/scandic-web/components/Forms/Signup/index.tsx index 40dbbe403..55f8b3756 100644 --- a/apps/scandic-web/components/Forms/Signup/index.tsx +++ b/apps/scandic-web/components/Forms/Signup/index.tsx @@ -249,8 +249,8 @@ export default function SignupForm({ defaultMessage: "Email address", })} name="email" - registerOptions={{ required: true }} type="email" + registerOptions={{ required: true }} /> {intl.formatMessage({ id: "signup.yesConsent", @@ -344,9 +342,7 @@ export default function SignupForm({ - {/* - This is a manual validation trigger workaround: - - The Controller component (which Input uses) doesn't re-render on submit, - which prevents automatic error display. - - Future fix requires Input component refactoring (out of scope for now). - */} - {!methods.formState.isValid ? ( - - ) : ( - - )} + diff --git a/packages/booking-flow/lib/components/BookingWidget/GuestsRoomsPicker/ChildSelector/ChildInfoSelector.tsx b/packages/booking-flow/lib/components/BookingWidget/GuestsRoomsPicker/ChildSelector/ChildInfoSelector.tsx index 2623ad0f7..d14b16348 100644 --- a/packages/booking-flow/lib/components/BookingWidget/GuestsRoomsPicker/ChildSelector/ChildInfoSelector.tsx +++ b/packages/booking-flow/lib/components/BookingWidget/GuestsRoomsPicker/ChildSelector/ChildInfoSelector.tsx @@ -146,7 +146,6 @@ export default function ChildInfoSelector({
setValue(DateName.day, Number(key))} - isRequired enableFiltering={isDesktop} isInvalid={fieldState.invalid} onBlur={field.onBlur} @@ -142,7 +141,6 @@ export default function DateSelect({ label={labels.month} name={DateName.month} onSelectionChange={(key) => setValue(DateName.month, Number(key))} - isRequired enableFiltering={isDesktop} isInvalid={fieldState.invalid} onBlur={field.onBlur} @@ -156,7 +154,6 @@ export default function DateSelect({ label={labels.year} name={DateName.year} onSelectionChange={(key) => setValue(DateName.year, Number(key))} - isRequired enableFiltering={isDesktop} isInvalid={fieldState.invalid} onBlur={field.onBlur} diff --git a/packages/design-system/lib/components/Form/FormInput/index.tsx b/packages/design-system/lib/components/Form/FormInput/index.tsx index c6bd8c77d..7489baf24 100644 --- a/packages/design-system/lib/components/Form/FormInput/index.tsx +++ b/packages/design-system/lib/components/Form/FormInput/index.tsx @@ -78,7 +78,6 @@ export const FormInput = forwardRef( isDisabled={isDisabled} isReadOnly={readOnly} isInvalid={fieldState.invalid} - isRequired={!!registerOptions.required} > ( isDisabled={isDisabled} isReadOnly={readOnly} isInvalid={fieldState.invalid} - isRequired={!!registerOptions.required} >