diff --git a/lib/core/form/components/widgets/core/form-field-types.ts b/lib/core/form/components/widgets/core/form-field-types.ts index 384eb5da52..fd3e70979f 100644 --- a/lib/core/form/components/widgets/core/form-field-types.ts +++ b/lib/core/form/components/widgets/core/form-field-types.ts @@ -43,11 +43,12 @@ export class FormFieldTypes { static READONLY_TYPES: string[] = [ FormFieldTypes.HYPERLINK, FormFieldTypes.DISPLAY_VALUE, - FormFieldTypes.READONLY_TEXT + FormFieldTypes.READONLY_TEXT, + FormFieldTypes.GROUP ]; static isReadOnlyType(type: string) { - return FormFieldTypes.READONLY_TYPES.indexOf(type) > -1; + return FormFieldTypes.READONLY_TYPES.includes(type); } static isContainerType(type: string) { diff --git a/lib/core/form/components/widgets/core/form-field.model.spec.ts b/lib/core/form/components/widgets/core/form-field.model.spec.ts index a1df477c8c..fffc71e25e 100644 --- a/lib/core/form/components/widgets/core/form-field.model.spec.ts +++ b/lib/core/form/components/widgets/core/form-field.model.spec.ts @@ -409,4 +409,38 @@ describe('FormFieldModel', () => { const field = new FormFieldModel(form, {}); expect(field).toBeDefined(); }); + + it('header field type should not appear into form values', () => { + const form = new FormModel(); + const field = new FormFieldModel(form, { + fieldType: 'HeaderFieldtype', + id: 'header_field', + name: 'header', + type: FormFieldTypes.GROUP, + value: '', + required: false, + readOnly: true + }); + field.updateForm(); + expect(form.values['header_field']).not.toBeDefined(); + }); + + it('dropdown field type should appear into form values', () => { + const form = new FormModel(); + const field = new FormFieldModel(form, { + fieldType: 'HeaderFieldtype', + id: 'dropdown_field', + name: 'header', + type: FormFieldTypes.DROPDOWN, + value: 'opt1', + required: false, + readOnly: true, + options: [ + {id: 'opt1', name: 'Option 1'}, + {id: 'opt2', name: 'Option 2'} + ] + }); + field.updateForm(); + expect(form.values['dropdown_field'].name).toEqual('Option 1'); + }); });