Handle empty label from Custom inputs (#7871)

* Handle empty label from Custom inputs

* Fix comment
pull/7873/head
Hariom Balhara 2023-03-22 00:14:18 +05:30 committed by GitHub
parent 427b19238d
commit 20b3efbcb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -295,12 +295,13 @@ export const ensureBookingInputsHaveSystemFields = ({
// Backward Compatibility: If we are migrating from old system, we need to map `customInputs` to `bookingFields`
if (handleMigration) {
customInputs.forEach((input) => {
customInputs.forEach((input, index) => {
bookingFields.push({
label: input.label,
editable: "user",
// Custom Input's slugified label was being used as query param for prefilling. So, make that the name of the field
name: slugify(input.label),
// Also Custom Input's label could have been empty string as well. But it's not possible to have empty name. So generate a name automatically.
name: slugify(input.label || `${input.type}-${index + 1}`),
placeholder: input.placeholder,
type: CustomInputTypeToFieldType[input.type],
required: input.required,