Merge pull request #830 from atmire/submission-repeatable-issue

Fix issue with repeatable scrollable dropdowns in the submission
This commit is contained in:
Tim Donohue
2020-08-06 15:14:45 -05:00
committed by GitHub
2 changed files with 8 additions and 1 deletions

View File

@@ -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)));

View File

@@ -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)) {