Skip to content

Commit

Permalink
119799: Prevent submission from updating the dropdown values when hit…
Browse files Browse the repository at this point in the history
…ting enter in another input form (onsubmit)
  • Loading branch information
alexandrevryghem committed Dec 4, 2024
1 parent 404ccd9 commit ed4e794
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions src/app/shared/form/form.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down

0 comments on commit ed4e794

Please sign in to comment.