Skip to content

Commit ac6d3a4

Browse files
alisaismailatiSimone-Ramundi
authored andcommitted
[CST-15850] trigger validators on submission form
1 parent e11f8f2 commit ac6d3a4

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -581,19 +581,20 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
581581
}
582582
}
583583

584-
585-
isNotRequiredGroupAndEmpty(): boolean {
584+
isNotRequiredGroupAndEmpty(): boolean {
586585
const parent = this.model.parent;
587586
if (hasValue(parent) && parent.type === 'GROUP') {
587+
console.log('this.model', this.model);
588+
console.log('parent', parent);
588589
const groupHasSomeValue = parent.group.some(elem => !!elem.value);
589590

590-
if(!groupHasSomeValue && !parent.isRequired) {
591-
this.group.reset()
592-
}
591+
if (!groupHasSomeValue && !parent.isRequired && parent.group?.length > 1) {
592+
this.group.reset();
593+
}
593594

594-
return (groupHasSomeValue && !parent.isRequired) || parent.isRequired;
595+
return (groupHasSomeValue && !parent.isRequired) || (hasValue(parent.isRequired) && parent.isRequired);
595596
} else {
596-
return true
597+
return true;
597598
}
598-
}
599+
}
599600
}

0 commit comments

Comments
 (0)