diff --git a/packages/features/form-builder/FormBuilder.tsx b/packages/features/form-builder/FormBuilder.tsx index 86ebc33b6e..aa308df96e 100644 --- a/packages/features/form-builder/FormBuilder.tsx +++ b/packages/features/form-builder/FormBuilder.tsx @@ -255,7 +255,7 @@ export const FormBuilder = function FormBuilder({ remove(index); }; - const fieldType = FieldTypesMap[fieldForm.watch("type")]; + const fieldType = FieldTypesMap[fieldForm.watch("type") || "text"]; const isFieldEditMode = fieldDialog.fieldIndex !== -1; return (
@@ -374,6 +374,7 @@ export const FormBuilder = function FormBuilder({
{ + const type = data.type || "text"; const isNewField = fieldDialog.fieldIndex == -1; if (isNewField && fields.some((f) => f.name === data.name)) { showToast(t("form_builder_field_already_exists"), "error"); @@ -384,6 +385,7 @@ export const FormBuilder = function FormBuilder({ } else { const field: RhfFormField = { ...data, + type, sources: [ { label: "User", @@ -402,7 +404,7 @@ export const FormBuilder = function FormBuilder({ }); }}> { - const fieldType = field.type; + const fieldType = field.type || "text"; const componentConfig = Components[fieldType]; const isValueOfPropsType = (val: unknown, propsType: typeof componentConfig.propsType) => {