diff --git a/src/app/submission/sections/form/section-form-operations.service.spec.ts b/src/app/submission/sections/form/section-form-operations.service.spec.ts index 580e3a9928..c76a15abcb 100644 --- a/src/app/submission/sections/form/section-form-operations.service.spec.ts +++ b/src/app/submission/sections/form/section-form-operations.service.spec.ts @@ -1,4 +1,4 @@ -import { waitForAsync, TestBed } from '@angular/core/testing'; +import { TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { @@ -35,10 +35,10 @@ describe('SectionFormOperationsService test suite', () => { let serviceAsAny: any; const jsonPatchOpBuilder: any = jasmine.createSpyObj('jsonPatchOpBuilder', { - add: jasmine.createSpy('add'), - replace: jasmine.createSpy('replace'), - remove: jasmine.createSpy('remove'), - }); + add: jasmine.createSpy('add'), + replace: jasmine.createSpy('replace'), + remove: jasmine.createSpy('remove'), + }); const pathCombiner = new JsonPatchOperationPathCombiner('sections', 'test'); const dynamicFormControlChangeEvent: DynamicFormControlEvent = { 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 1c372fb06f..f4bb3888b3 100644 --- a/src/app/submission/sections/form/section-form-operations.service.ts +++ b/src/app/submission/sections/form/section-form-operations.service.ts @@ -285,9 +285,10 @@ export class SectionFormOperationsService { previousValue: FormFieldPreviousValueObject): void { const path = this.getFieldPathFromEvent(event); const value = this.getFieldValueFromChangeEvent(event); + console.log(value); if (this.formBuilder.isQualdropGroup(event.model as DynamicFormControlModel)) { this.dispatchOperationsFromMap(this.getQualdropValueMap(event), pathCombiner, event, previousValue); - } else if (isNotEmpty(value) && (value instanceof FormFieldMetadataValueObject && value.hasValue())) { + } else if ((isNotEmpty(value) && typeof value === 'string') || (isNotEmpty(value) && value instanceof FormFieldMetadataValueObject && value.hasValue())) { this.operationsBuilder.remove(pathCombiner.getPath(path)); } }