diff --git a/lambdas/packages/hrm-form-definitions/form-definitions/as/v1/tabbedForms/ChildInformationTab.json b/lambdas/packages/hrm-form-definitions/form-definitions/as/v1/tabbedForms/ChildInformationTab.json index 583db35cc8..035877a312 100644 --- a/lambdas/packages/hrm-form-definitions/form-definitions/as/v1/tabbedForms/ChildInformationTab.json +++ b/lambdas/packages/hrm-form-definitions/form-definitions/as/v1/tabbedForms/ChildInformationTab.json @@ -3,7 +3,8 @@ "name": "firstName", "label": "First Name", "type": "input", - "isPII": true + "isPII": true, + "isDisabled": true }, { "name": "lastName", diff --git a/lambdas/packages/hrm-form-definitions/src/formDefinition/types.ts b/lambdas/packages/hrm-form-definitions/src/formDefinition/types.ts index daad0dc453..669c85e337 100644 --- a/lambdas/packages/hrm-form-definitions/src/formDefinition/types.ts +++ b/lambdas/packages/hrm-form-definitions/src/formDefinition/types.ts @@ -64,6 +64,7 @@ type ItemBase = { required?: { value: boolean; message: string } | boolean; maxLength?: { value: number; message: string }; validate?: (data: any) => string | boolean; + isDisabled?: boolean; } & IsPIIFlag; type NonSaveable = { diff --git a/plugin-hrm-form/src/components/forms/hooks/useCreateFormFromDefinition.tsx b/plugin-hrm-form/src/components/forms/hooks/useCreateFormFromDefinition.tsx index 070dde9fbb..5fa0dd8fa2 100644 --- a/plugin-hrm-form/src/components/forms/hooks/useCreateFormFromDefinition.tsx +++ b/plugin-hrm-form/src/components/forms/hooks/useCreateFormFromDefinition.tsx @@ -35,7 +35,7 @@ type UseFormFromDefinition = { }; }; -const alwaysEnabled = () => true; +const alwaysEnabled = (item: FormItemDefinition) => !((item as any).isDisabled ?? false); const useCreateFormFromDefinition = ({ definition, diff --git a/plugin-hrm-form/src/components/forms/inputGenerator.tsx b/plugin-hrm-form/src/components/forms/inputGenerator.tsx index ed8776657b..443b38f733 100644 --- a/plugin-hrm-form/src/components/forms/inputGenerator.tsx +++ b/plugin-hrm-form/src/components/forms/inputGenerator.tsx @@ -50,7 +50,7 @@ export const createInput = ({ formItemDefinition, parentsPath, updateCallback, - isItemEnabled = () => true, + isItemEnabled = (item) => !((item as any).isDisabled ?? false), initialValue, customHandlers, htmlElRef = null,