Skip to content

Commit b3c3c7e

Browse files
FrancescoMolinaroatarix83
authored andcommitted
Merged in task/dspace-cris-2023_02_x/DSC-1823-fix (pull request DSpace#2427)
[CST-15396] fix method for error reset in non mandatory groups Approved-by: Giuseppe Digilio
2 parents cfe57e2 + c6a4da7 commit b3c3c7e

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,8 +583,9 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
583583

584584
isNotRequiredGroupAndEmpty(): boolean {
585585
const parent = this.model.parent;
586-
587-
if (hasValue(parent) && parent.type === 'GROUP') {
586+
// Check if the model is part of a group, the group needs to be an inner form and be in the submission form not in a nested form.
587+
// The check hasValue(parent.parent) tells if the parent is in the submission or in a modal (nested cases)
588+
if (hasValue(parent) && parent.type === 'GROUP' && this.model.isModelOfInnerForm && hasValue(parent.parent)) {
588589

589590
const groupHasSomeValue = parent.group.some(elem => !!elem.value);
590591

src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
[attr.aria-labelledby]="'label_' + model.id"
1515
[attr.tabindex]="item.index"
1616
[checked]="item.value"
17+
[class.is-invalid]="showErrorMessages"
1718
[id]="model.id + item.id"
1819
[formControlName]="item.id"
1920
[name]="model.name"
@@ -46,6 +47,7 @@
4647

4748
<input type="radio" class="custom-control-input"
4849
[checked]="item.value"
50+
[class.is-invalid]="showErrorMessages"
4951
[id]="model.id + item.id"
5052
[name]="model.id"
5153
[required]="model.required"

0 commit comments

Comments
 (0)