Merged in fix(BOOK-659)-multiroom-name-check (pull request #3385)

fix(BOOK-659): use unique ids for multiroom booking input fields

* fix(BOOK-659): use unique ids for multiroom booking input fields


Approved-by: Bianca Widstam
Approved-by: Linus Flood
This commit is contained in:
Matilda Landström
2026-01-05 11:20:20 +00:00
committed by Linus Flood
parent dc18589afe
commit d23137a69d
5 changed files with 12 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
helpText?: string helpText?: string
label: string label: string
name: string name: string
id?: string
registerOptions?: RegisterOptions registerOptions?: RegisterOptions
hideError?: boolean hideError?: boolean
} }
@@ -28,6 +29,7 @@ const BookingFlowInput = forwardRef<HTMLInputElement, InputProps>(
label, label,
maxLength, maxLength,
name, name,
id,
placeholder, placeholder,
readOnly = false, readOnly = false,
registerOptions = {}, registerOptions = {},
@@ -61,6 +63,7 @@ const BookingFlowInput = forwardRef<HTMLInputElement, InputProps>(
inputMode={inputMode} inputMode={inputMode}
label={label} label={label}
maxLength={maxLength} maxLength={maxLength}
id={id}
name={name} name={name}
placeholder={placeholder} placeholder={placeholder}
readOnly={readOnly} readOnly={readOnly}

View File

@@ -217,6 +217,7 @@ export default function Details() {
defaultMessage: "First name", defaultMessage: "First name",
})} })}
maxLength={30} maxLength={30}
id={`firstName-room-${roomNr}`}
name="firstName" name="firstName"
registerOptions={{ registerOptions={{
required: true, required: true,
@@ -236,6 +237,7 @@ export default function Details() {
defaultMessage: "Last name", defaultMessage: "Last name",
})} })}
maxLength={30} maxLength={30}
id={`lastName-room-${roomNr}`}
name="lastName" name="lastName"
registerOptions={{ registerOptions={{
required: true, required: true,
@@ -277,6 +279,7 @@ export default function Details() {
id: "common.emailAddress", id: "common.emailAddress",
defaultMessage: "Email address", defaultMessage: "Email address",
})} })}
id={`email-room-${roomNr}`}
name="email" name="email"
registerOptions={{ required: true, onBlur: updateDetailsStore }} registerOptions={{ required: true, onBlur: updateDetailsStore }}
/> />
@@ -319,6 +322,7 @@ export default function Details() {
id: "common.membershipId", id: "common.membershipId",
defaultMessage: "Membership ID", defaultMessage: "Membership ID",
})} })}
id={`membershipNo-room-${roomNr}`}
name="membershipNo" name="membershipNo"
type="tel" type="tel"
registerOptions={{ onBlur: updateDetailsStore }} registerOptions={{ onBlur: updateDetailsStore }}

View File

@@ -36,6 +36,7 @@ import useLang from "../../../hooks/useLang"
import { useEnterDetailsStore } from "../../../stores/enter-details" import { useEnterDetailsStore } from "../../../stores/enter-details"
import ConfirmBooking from "../Confirm" import ConfirmBooking from "../Confirm"
import PriceChangeDialog from "../PriceChangeDialog" import PriceChangeDialog from "../PriceChangeDialog"
import { writeGlaToSessionStorage } from "./PaymentCallback/helpers"
import BookingAlert from "./BookingAlert" import BookingAlert from "./BookingAlert"
import { GuaranteeInfo } from "./GuaranteeInfo" import { GuaranteeInfo } from "./GuaranteeInfo"
import { import {
@@ -46,7 +47,6 @@ import {
mustGuaranteeBooking, mustGuaranteeBooking,
writePaymentInfoToSessionStorage, writePaymentInfoToSessionStorage,
} from "./helpers" } from "./helpers"
import { writeGlaToSessionStorage } from "./PaymentCallback/helpers"
import { type PaymentFormData, paymentSchema } from "./schema" import { type PaymentFormData, paymentSchema } from "./schema"
import { getPaymentHeadingConfig } from "./utils" import { getPaymentHeadingConfig } from "./utils"

View File

@@ -35,6 +35,7 @@ export const FormInput = forwardRef<HTMLInputElement, FormInputProps>(
labelPosition = 'floating', labelPosition = 'floating',
maxLength, maxLength,
name, name,
id,
placeholder, placeholder,
readOnly = false, readOnly = false,
registerOptions = {}, registerOptions = {},
@@ -88,7 +89,7 @@ export const FormInput = forwardRef<HTMLInputElement, FormInputProps>(
onChange={field.onChange} onChange={field.onChange}
value={field.value ?? ''} value={field.value ?? ''}
autoComplete={autoComplete} autoComplete={autoComplete}
id={field.name} id={id ?? field.name}
label={label} label={label}
labelPosition={labelPosition} labelPosition={labelPosition}
maxLength={maxLength} maxLength={maxLength}

View File

@@ -9,6 +9,8 @@ export interface FormInputProps extends InputProps {
description?: string description?: string
/** Icon to display with the description text. Defaults to 'info' */ /** Icon to display with the description text. Defaults to 'info' */
descriptionIcon?: MaterialIconProps['icon'] descriptionIcon?: MaterialIconProps['icon']
/** Field id for react-hook-form registration */
id?: string
/** Field name for react-hook-form registration */ /** Field name for react-hook-form registration */
name: string name: string
/** react-hook-form validation rules */ /** react-hook-form validation rules */