1
0

119799: Prevent submission from updating the dropdown values when hitting enter in another input form (onsubmit)

This commit is contained in:
Alexandre Vryghem
2024-12-04 17:16:14 +01:00
parent 404ccd9b0e
commit ed4e794d46
2 changed files with 7 additions and 2 deletions

View File

@@ -41,10 +41,12 @@
(scrolled)="onScroll()"
[scrollWindow]="false">
<button class="dropdown-item disabled" *ngIf="optionsList && optionsList.length == 0">{{'form.no-results' | translate}}</button>
<button class="dropdown-item disabled" type="button" *ngIf="optionsList && optionsList.length == 0">
{{ 'form.no-results' | translate }}
</button>
<button class="dropdown-item collection-item text-truncate" *ngFor="let listEntry of optionsList"
(click)="onSelect(listEntry); sdRef.close()" (mousedown)="onSelect(listEntry); sdRef.close()"
title="{{ listEntry.display }}" role="option"
title="{{ listEntry.display }}" role="option" type="button"
[attr.id]="listEntry.display == (currentValue|async) ? ('combobox_' + id + '_selected') : null">
{{inputFormatter(listEntry)}}
</button>

View File

@@ -130,6 +130,9 @@ export class FormService {
}
public addControlErrors(field: AbstractControl, formId: string, fieldId: string, fieldIndex: number) {
if (field.errors === null) {
return;
}
const errors: string[] = Object.keys(field.errors)
.filter((errorKey) => field.errors[errorKey] === true)
.map((errorKey) => `error.validation.${errorKey}`);