diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/onebox/dynamic-onebox.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/onebox/dynamic-onebox.component.ts index fa9fe2103a..0cc9f66ef7 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/onebox/dynamic-onebox.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/onebox/dynamic-onebox.component.ts @@ -46,7 +46,7 @@ export class DsDynamicOneboxComponent extends DsDynamicVocabularyComponent imple @ViewChild('instance', { static: false }) instance: NgbTypeahead; - pageInfo: PageInfo; + pageInfo: PageInfo = new PageInfo(); searching = false; searchFailed = false; hideSearchingWhenUnsubscribed$ = new Observable(() => () => this.changeSearchingStatus(false)); @@ -247,6 +247,7 @@ export class DsDynamicOneboxComponent extends DsDynamicVocabularyComponent imple this.getInitValueFromModel() .subscribe((formValue: FormFieldMetadataValueObject) => { this.currentValue = formValue; + this.cdr.detectChanges(); }); } else { if (isEmpty(value)) { @@ -258,6 +259,7 @@ export class DsDynamicOneboxComponent extends DsDynamicVocabularyComponent imple } this.currentValue = result; + this.cdr.detectChanges(); } } diff --git a/src/app/shared/form/form.component.ts b/src/app/shared/form/form.component.ts index dee06c29b2..286f2673de 100644 --- a/src/app/shared/form/form.component.ts +++ b/src/app/shared/form/form.component.ts @@ -11,6 +11,7 @@ import { FormService } from './form.service'; import { FormEntry, FormError } from './form.reducer'; import { DYNAMIC_FORM_CONTROL_TYPE_SCROLLABLE_DROPDOWN } from './builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.model'; import { QUALDROP_GROUP_SUFFIX } from './builder/ds-dynamic-form-ui/models/ds-dynamic-qualdrop.model'; +import { DYNAMIC_FORM_CONTROL_TYPE_ONEBOX } from './builder/ds-dynamic-form-ui/models/onebox/dynamic-onebox.model'; const QUALDROP_GROUP_REGEX = new RegExp(`${QUALDROP_GROUP_SUFFIX}_\\d+$`); @@ -316,7 +317,7 @@ export class FormComponent implements OnDestroy, OnInit { // set that field to the new value const model = arrayContext.groups[arrayContext.groups.length - 1].group[0] as any; - if (model.type === DYNAMIC_FORM_CONTROL_TYPE_SCROLLABLE_DROPDOWN) { + if (model.type === DYNAMIC_FORM_CONTROL_TYPE_SCROLLABLE_DROPDOWN || model.type === DYNAMIC_FORM_CONTROL_TYPE_ONEBOX) { model.value = Object.values(value)[0]; } else if (this.formBuilderService.isQualdropGroup(model)) { const ctrl = formArrayControl.controls[formArrayControl.length - 1];