diff --git a/src/app/shared/form/form.component.ts b/src/app/shared/form/form.component.ts index dee06c29b2..9886eb28d2 100644 --- a/src/app/shared/form/form.component.ts +++ b/src/app/shared/form/form.component.ts @@ -318,6 +318,12 @@ export class FormComponent implements OnDestroy, OnInit { const model = arrayContext.groups[arrayContext.groups.length - 1].group[0] as any; if (model.type === DYNAMIC_FORM_CONTROL_TYPE_SCROLLABLE_DROPDOWN) { model.value = Object.values(value)[0]; + const ctrl = formArrayControl.controls[formArrayControl.length - 1]; + const ctrlValue = ctrl.value; + const ctrlValueKey = Object.keys(ctrlValue)[0]; + ctrl.setValue({ + [ctrlValueKey]: model.value + }); } else if (this.formBuilderService.isQualdropGroup(model)) { const ctrl = formArrayControl.controls[formArrayControl.length - 1]; const ctrlKey = Object.keys(ctrl.value).find((key: string) => isNotEmpty(key.match(QUALDROP_GROUP_REGEX))); diff --git a/src/app/submission/sections/form/section-form-operations.service.ts b/src/app/submission/sections/form/section-form-operations.service.ts index 6e7a35fe26..28bf71b210 100644 --- a/src/app/submission/sections/form/section-form-operations.service.ts +++ b/src/app/submission/sections/form/section-form-operations.service.ts @@ -28,6 +28,7 @@ import { FormBuilderService } from '../../../shared/form/builder/form-builder.se import { FormFieldMetadataValueObject } from '../../../shared/form/builder/models/form-field-metadata-value.model'; import { DynamicQualdropModel } from '../../../shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-qualdrop.model'; import { DynamicRelationGroupModel } from '../../../shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model'; +import { deepClone } from 'fast-json-patch'; /** * The service handling all form section operations @@ -310,7 +311,7 @@ export class SectionFormOperationsService { event: DynamicFormControlEvent ): void { const path = this.getFieldPathSegmentedFromChangeEvent(event); - const value = this.getFieldValueFromChangeEvent(event); + const value = deepClone(this.getFieldValueFromChangeEvent(event)); if (isNotEmpty(value)) { value.place = this.getArrayIndexFromEvent(event); if (hasValue(event.group) && hasValue(event.group.value)) {