Skip to content

Commit ed4e794

Browse files
119799: Prevent submission from updating the dropdown values when hitting enter in another input form (onsubmit)
1 parent 404ccd9 commit ed4e794

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@
4141
(scrolled)="onScroll()"
4242
[scrollWindow]="false">
4343

44-
<button class="dropdown-item disabled" *ngIf="optionsList && optionsList.length == 0">{{'form.no-results' | translate}}</button>
44+
<button class="dropdown-item disabled" type="button" *ngIf="optionsList && optionsList.length == 0">
45+
{{ 'form.no-results' | translate }}
46+
</button>
4547
<button class="dropdown-item collection-item text-truncate" *ngFor="let listEntry of optionsList"
4648
(click)="onSelect(listEntry); sdRef.close()" (mousedown)="onSelect(listEntry); sdRef.close()"
47-
title="{{ listEntry.display }}" role="option"
49+
title="{{ listEntry.display }}" role="option" type="button"
4850
[attr.id]="listEntry.display == (currentValue|async) ? ('combobox_' + id + '_selected') : null">
4951
{{inputFormatter(listEntry)}}
5052
</button>

src/app/shared/form/form.service.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ export class FormService {
130130
}
131131

132132
public addControlErrors(field: AbstractControl, formId: string, fieldId: string, fieldIndex: number) {
133+
if (field.errors === null) {
134+
return;
135+
}
133136
const errors: string[] = Object.keys(field.errors)
134137
.filter((errorKey) => field.errors[errorKey] === true)
135138
.map((errorKey) => `error.validation.${errorKey}`);

0 commit comments

Comments
 (0)