Fix - Validate value on remove item for submission form only for qualdrop component

This commit is contained in:
VictorDuranEscire
2025-02-07 21:12:03 -06:00
parent 64c6c19618
commit 1e73fa626d

View File

@@ -362,7 +362,7 @@ export class FormComponent implements OnDestroy, OnInit {
removeItem($event, arrayContext: DynamicFormArrayModel, index: number): void { removeItem($event, arrayContext: DynamicFormArrayModel, index: number): void {
const formArrayControl = this.formGroup.get(this.formBuilderService.getPath(arrayContext)) as UntypedFormArray; const formArrayControl = this.formGroup.get(this.formBuilderService.getPath(arrayContext)) as UntypedFormArray;
const event = this.getEvent($event, arrayContext, index, 'remove'); const event = this.getEvent($event, arrayContext, index, 'remove');
if (this.formBuilderService.isQualdropGroup(event.model as DynamicFormControlModel)) { if (this.formBuilderService.isQualdropGroup(event.model as DynamicFormControlModel) && hasValue((event.model as any)?.value)) {
// In case of qualdrop value remove event must be dispatched before removing the control from array // In case of qualdrop value remove event must be dispatched before removing the control from array
this.removeArrayItem.emit(event); this.removeArrayItem.emit(event);
} }