diff --git a/apps/web/components/booking/pages/BookingPage.tsx b/apps/web/components/booking/pages/BookingPage.tsx index 15c94dae69..06411a3878 100644 --- a/apps/web/components/booking/pages/BookingPage.tsx +++ b/apps/web/components/booking/pages/BookingPage.tsx @@ -315,6 +315,22 @@ const BookingPage = ({ {} ); + if (eventType.customInputs.length > 0) { + // find all required custom inputs and ensure they are filled out in the booking form + const requiredCustomInputs = eventType.customInputs.filter((input) => input.required); + const missingRequiredCustomInputs = requiredCustomInputs.filter( + (input) => !booking?.customInputs?.[input.id] + ); + if (missingRequiredCustomInputs.length > 0) { + missingRequiredCustomInputs.forEach((input) => { + bookingForm.setError(`customInputs.${input.id}`, { + type: "required", + }); + }); + return; + } + } + if (recurringDates.length) { // Identify set of bookings to one intance of recurring event to support batch changes const recurringEventId = uuidv4(); @@ -679,8 +695,11 @@ const BookingPage = ({ {input.type !== EventTypeCustomInputType.BOOL && ( )} {input.type === EventTypeCustomInputType.TEXTLONG && ( @@ -745,24 +764,28 @@ const BookingPage = ({ )} {input.options && input.type === EventTypeCustomInputType.RADIO && ( -
-
- { - bookingForm.setValue(`customInputs.${input.id}`, e); - }}> - <> - {input.options.map((option, i) => ( - - ))} - - -
+
+ { + bookingForm.setValue(`customInputs.${input.id}`, e); + }}> + <> + {input.options.map((option, i) => ( + + ))} + + {bookingForm.formState.errors.customInputs?.[input.id] && ( +
+

{t("required")}

+
+ )} +
)}