diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/radio-box/description-template-editor-radio-box-field.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/radio-box/description-template-editor-radio-box-field.component.html index 255585aef..0b64347ff 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/radio-box/description-template-editor-radio-box-field.component.html +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/radio-box/description-template-editor-radio-box-field.component.html @@ -1,15 +1,17 @@
-
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RADIO-BOX-TITLE' +
{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RADIO-BOX-TITLE' | translate}}
warning_amber - {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.ERROR-MESSAGES.FIELD-RADIO-AT-LEAST-ONE-REQUIRED'| translate}} + {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.ERROR-MESSAGES.FIELD-RADIO-AT-LEAST-ONE-REQUIRED'| translate}} + {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.ERROR-MESSAGES.FIELD-RADIO-AT-LEAST-ONE-REQUIRED' | translate}} + {{form.get('data').get('options').getError('backendError').message}}
@@ -17,14 +19,16 @@
- {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RADIO-BOX-LABEL' | translate}} - + {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RADIO-BOX-LABEL' | translate}} + {{option.get('label').getError('backendError').message}} + {{'GENERAL.VALIDATION.REQUIRED' | translate}} - {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RADIO-BOX-VALUE' | translate}} - + {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RADIO-BOX-VALUE' | translate}} + {{option.get('value').getError('backendError').message}} + {{'GENERAL.VALIDATION.REQUIRED' | translate}}
- {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-SELECT' | translate}} + {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-WORDLIST' | translate}} {{form.get('data').get('multipleSelect').getError('backendError').message}} @@ -36,6 +36,8 @@
+ {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.ERROR-MESSAGES.FIELD-RADIO-AT-LEAST-ONE-REQUIRED' | translate}} + {{form.get('data').get('options').getError('backendError').message}}
diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/section-fieldset/description-template-editor-section-fieldset.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/components/section-fieldset/description-template-editor-section-fieldset.component.html index 8e97fb165..dc1f89400 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/section-fieldset/description-template-editor-section-fieldset.component.html +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/section-fieldset/description-template-editor-section-fieldset.component.html @@ -65,7 +65,7 @@ [hasFocus]="fieldset.get('id').value === selectedFieldSetId" [datasetProfileId]="datasetProfileId" [validationErrorModel]="validationErrorModel" - [rootPath]="rootPath"> + [rootPath]="rootPath + 'fieldSets[' + i + '].'"> diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.ts index 027bc2fd4..e6064e396 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.ts +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.ts @@ -616,6 +616,10 @@ export class DescriptionTemplateEditorComponent extends BaseEditor { parentSectionRootPath = parentSectionRootPath + 'sections[' + index +'].' }); + + sectionsArray = parent.form.get('sections') as UntypedFormArray; + + //adding page parent MAYBE NOT NEEDED + try { + const maxOrdinal = sectionsArray.controls.map(control => control.get('ordinal').value).reduce((a, b) => Math.max(a, b)); + section.ordinal = maxOrdinal + 1; + } catch { + section.ordinal = sectionsArray.length; + } + + //store rootPath for next levels/components + this.rootPath = 'definition.pages['+ pageIndex +'].'+ parentSectionRootPath; + + sectionsArray.push(section.buildForm({ rootPath: 'definition.pages['+ pageIndex +'].' + parentSectionRootPath + 'sections[' + sectionsArray.length + '].' })); + // (child.form.parent as FormArray).push(section.buildForm()); + } - - sectionsArray = parent.form.get('sections') as UntypedFormArray; - - //adding page parent MAYBE NOT NEEDED - try { - const maxOrdinal = sectionsArray.controls.map(control => control.get('ordinal').value).reduce((a, b) => Math.max(a, b)); - section.ordinal = maxOrdinal + 1; - } catch { - section.ordinal = sectionsArray.length; - } - - sectionsArray.push(section.buildForm({ rootPath: 'definition.pages['+ pageIndex +'].' + parentSectionRootPath + 'sections[' + sectionsArray.length + '].' })); - // (child.form.parent as FormArray).push(section.buildForm()); - } else { console.error('Section can only be child of a page or another section'); } @@ -687,8 +694,6 @@ export class DescriptionTemplateEditorComponent extends BaseEditor item.buildForm({ rootPath: `${rootPath}sources[${index}].` - }), context.getValidation('sources') - ))); + }) + ), context.getValidation('sources').validators + )); return formGroup; } @@ -1583,8 +1584,9 @@ export class DescriptionTemplateRadioBoxDataEditorModel extends DescriptionTempl this.validationErrorModel ).fromModel(item).buildForm({ rootPath: `${rootPath}options[${index}].` - }), context.getValidation('options') - ))); + }) + ), context.getValidation('options').validators + )); return formGroup; } @@ -1729,8 +1731,9 @@ export class DescriptionTemplateSelectDataEditorModel extends DescriptionTemplat this.validationErrorModel ).fromModel(item).buildForm({ rootPath: `${rootPath}options[${index}].` - }), context.getValidation('options') - ))); + }) + ), context.getValidation('options').validators + )); return formGroup; }